diff --git a/NEWS b/NEWS index 77676d0f432..24ffd4cd4d6 100644 --- a/NEWS +++ b/NEWS @@ -82,6 +82,8 @@ PHP NEWS - Fixed memory leaks in openssl streams context options. (Pierre) - Fixed handling of extremely long paths inside tempnam() function. (Ilia) +- Fixed bug #38072 (boolean arg for mysqli_autocommit() is always true on + Solaris). (Tony) - Fixed bug #38067 (Parameters are not decoded from utf-8 when using encoding option). (Dmitry) - Fixed bug #38055 (Wrong interpretation of boolean parameters). (Dmitry) diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 51d219a3236..d8b0b683a26 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -57,14 +57,14 @@ PHP_FUNCTION(mysqli_autocommit) { MY_MYSQL *mysql; zval *mysql_link; - unsigned long automode; + zend_bool automode; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID); - if (mysql_autocommit(mysql->mysql, automode)) { + if (mysql_autocommit(mysql->mysql, (my_bool)automode)) { RETURN_FALSE; } RETURN_TRUE; diff --git a/ext/mysqli/tests/068.phpt b/ext/mysqli/tests/068.phpt new file mode 100644 index 00000000000..ab407c1ad8e --- /dev/null +++ b/ext/mysqli/tests/068.phpt @@ -0,0 +1,33 @@ +--TEST-- +mysqli_autocommit() tests +--SKIPIF-- + +--FILE-- +autocommit(false)); +$result = $mysqli->query("SELECT @@autocommit"); +var_dump($result->fetch_row()); + +var_dump($mysqli->autocommit(true)); +$result = $mysqli->query("SELECT @@autocommit"); +var_dump($result->fetch_row()); + +?> +--EXPECT-- +bool(true) +array(1) { + [0]=> + string(1) "0" +} +bool(true) +array(1) { + [0]=> + string(1) "1" +}