From: Antony Dovgal Date: Wed, 12 Jul 2006 09:51:47 +0000 (+0000) Subject: fix #38072 (boolean arg for mysqli_autocommit() is always true on Solaris) X-Git-Tag: php-5.2.0RC1~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a35e9d014d43727c5ca3aab1064b728510d5c90;p=php fix #38072 (boolean arg for mysqli_autocommit() is always true on Solaris) --- diff --git a/NEWS b/NEWS index 77676d0f43..24ffd4cd4d 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 51d219a323..d8b0b683a2 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 0000000000..ab407c1ad8 --- /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" +}