]> granicus.if.org Git - php/commitdiff
fix #38072 (boolean arg for mysqli_autocommit() is always true on Solaris)
authorAntony Dovgal <tony2001@php.net>
Wed, 12 Jul 2006 09:51:47 +0000 (09:51 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 12 Jul 2006 09:51:47 +0000 (09:51 +0000)
NEWS
ext/mysqli/mysqli_api.c
ext/mysqli/tests/068.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 77676d0f43252f50408dd8e8f0cacc16f9c43a5e..24ffd4cd4d6eeb2b5e5bd1ef4c029f2bb4f51344 100644 (file)
--- 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)
index 51d219a32360de8469ba7a737c13b134790a0478..d8b0b683a26ba22659ae23d230567f2be9ba7830 100644 (file)
@@ -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 (file)
index 0000000..ab407c1
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+mysqli_autocommit() tests
+--SKIPIF--
+<?php 
+       require_once('skipif.inc'); 
+?>
+--FILE--
+<?php
+
+include "connect.inc";
+
+$mysqli = new mysqli($host, $user, $passwd, "test");
+
+var_dump($mysqli->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"
+}