andrey Fri, 25 Sep 2009 12:25:54 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=288784
Log: Fix mysqli_stmt_attr_set in libmysql mode. mysql_stmt_attr_set returns my_bool instead of int. If it was int, then 0 is success and !0 is failure, but for my_bool 0 (FALSE) is failure and !0 is success. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2009-09-25 12:25:54 UTC (rev 288784) @@ -2128,7 +2128,7 @@ mode = mode_in; #if !defined(MYSQLI_USE_MYSQLND) - if (mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) { + if (FALSE == mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) { #else if (FAIL == mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) { #endif Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:25:54 UTC (rev 288784) @@ -58,7 +58,7 @@ do { $invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX); } while (in_array($invalid_attr, $valid_attr)); - if (true !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) /* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */ printf("[006b] Expecting boolean/true for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp); } @@ -265,4 +265,4 @@ require_once("clean_table.inc"); ?> --EXPECTF-- -done! \ No newline at end of file +done! Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c =================================================================== --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 12:25:54 UTC (rev 288784) @@ -2190,7 +2190,7 @@ mode = mode_in; #if !defined(MYSQLI_USE_MYSQLND) - if (mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) { + if (FALSE == mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) { #else if (FAIL == mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode)) { #endif Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt =================================================================== --- php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:25:54 UTC (rev 288784) @@ -58,7 +58,7 @@ do { $invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX); } while (in_array($invalid_attr, $valid_attr)); - if (true !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) /* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */ printf("[006b] Expecting boolean/true for attribute %d, got %s/%s\n", $invalid_attr, gettype($tmp), $tmp); } @@ -265,4 +265,4 @@ require_once("clean_table.inc"); ?> --EXPECTF-- -done! \ No newline at end of file +done!
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php