[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqli/tests/ bug34810.phpt
uw Wed, 23 Nov 2011 17:30:59 + Revision: http://svn.php.net/viewvc?view=revision&revision=319722 Log: Good to fix something, but don't forget to update tests Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt 2011-11-23 17:27:44 UTC (rev 319721) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt 2011-11-23 17:30:59 UTC (rev 319722) @@ -89,6 +89,8 @@ %unicode|string%(%d) "%s" [%u|b%"server_version"]=> int(%d) + ["stat"]=> + %s [%u|b%"sqlstate"]=> %unicode|string%(5) "0" [%u|b%"protocol_version"]=> @@ -125,6 +127,8 @@ NULL [%u|b%"server_version"]=> NULL + ["stat"]=> + NULL [%u|b%"sqlstate"]=> NULL [%u|b%"protocol_version"]=> -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt branches/PHP_5_3/ext/mysqli/tests/bug50772.phpt trunk/ext/mysqli/tests/bug34810.phpt trunk/ext/mysqli/tests/bug50772.phpt
uw Tue, 08 Jun 2010 14:29:05 + Revision: http://svn.php.net/viewvc?view=revision&revision=300279 Log: Portability improvements Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50772.phpt U php/php-src/trunk/ext/mysqli/tests/bug34810.phpt U php/php-src/trunk/ext/mysqli/tests/bug50772.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt 2010-06-08 13:48:02 UTC (rev 300278) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt 2010-06-08 14:29:05 UTC (rev 300279) @@ -24,7 +24,24 @@ $mysql->query("CREATE TABLE test_warnings (a int not null)"); $mysql->query("SET sql_mode=''"); $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)"); - var_dump($mysql->get_warnings()); + + $warning = $mysql->get_warnings(); + if (!$warning) + printf("[001] No warning!\n"); + + if ($warning->errno == 1048 || $warning->errno == 1253) { + /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */ + if ("HY000" != $warning->sqlstate) + printf("[003] Wrong sql state code: %s\n", $warning->sqlstate); + + if ("" == $warning->message) + printf("[004] Message string must not be empty\n"); + + + } else { + printf("[002] Empty error message!\n"); + var_dump($warning); + } } } @@ -117,12 +134,4 @@ [%u|b%"warning_count"]=> NULL } -object(mysqli_warning)#%d (%d) { - [%u|b%"message"]=> - %unicode|string%(25) "Column 'a' cannot be null" - [%u|b%"sqlstate"]=> - %unicode|string%(5) "HY000" - [%u|b%"errno"]=> - int(1048) -} Done Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50772.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50772.phpt 2010-06-08 13:48:02 UTC (rev 300278) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug50772.phpt 2010-06-08 14:29:05 UTC (rev 300279) @@ -12,7 +12,7 @@ // These calls fail $db1->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3); - $db1->real_connect($host, $user, $passwd); + my_mysqli_real_connect($db1, $host, $user, $passwd, $db, $port, $socket); if(mysqli_connect_error()) { echo "error 1\n"; } else { @@ -22,7 +22,7 @@ $db2 = mysqli_init(); $db2->options(MYSQLI_OPT_CONNECT_TIMEOUT, 3); - $db2->real_connect($host, $user, $passwd); + my_mysqli_real_connect($db2, $host, $user, $passwd, $db, $port, $socket); if(mysqli_connect_error()) { echo "error 2\n"; } else { Modified: php/php-src/trunk/ext/mysqli/tests/bug34810.phpt === --- php/php-src/trunk/ext/mysqli/tests/bug34810.phpt2010-06-08 13:48:02 UTC (rev 300278) +++ php/php-src/trunk/ext/mysqli/tests/bug34810.phpt2010-06-08 14:29:05 UTC (rev 300279) @@ -24,7 +24,24 @@ $mysql->query("CREATE TABLE test_warnings (a int not null)"); $mysql->query("SET sql_mode=''"); $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)"); - var_dump($mysql->get_warnings()); + + $warning = $mysql->get_warnings(); + if (!$warning) + printf("[001] No warning!\n"); + + if ($warning->errno == 1048 || $warning->errno == 1253) { + /* 1048 - Column 'a' cannot be null, 1263 - Data truncated; NULL supplied to NOT NULL column 'a' at row */ + if ("HY000" != $warning->sqlstate) + printf("[003] Wrong sql state code: %s\n", $warning->sqlstate); + + if ("" == $warning->message) + printf("[004] Message string must not be empty\n"); + + + } else { + printf("[002] Empty error message!\n"); + var_dump($warning); + } } } @@ -117,12 +134,4 @@ [%u|b%"warning_count"]=> NULL } -object(mysqli_warning)#%d (%d) { - [%u|b%"message"]=> - %unicode|string%(25) "Column 'a' cannot be null" - [%u|b%"sqlstate"]=> - %unicode|string%(5) "HY000" - [%u|b%"errno"]=> - int(1048) -} Done Modified: php/php-src/trunk/ext/mysqli/tests/bug50772.phpt === --- php/php-src/trunk/ext/mysqli/tests/bug50772.phpt2010-06-08 13:48
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt branches/PHP_5_3/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt branches/PHP_5_3/ext/mysqli/tests/mysqli_connect_error
uw Wed, 09 Dec 2009 12:06:10 + Revision: http://svn.php.net/viewvc?view=revision&revision=291916 Log: Adapting tests to accept actual behaviour found in 5.2, 5.3 and 6.0. The behaviour is wrong according to the documentation: mysqli_connect_error() should return an empty string (not NULL), if there is no error. However, changing this would break BC and most users will not notice the difference between NULL and empty string anyway. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_connect_error.phpt U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_kill.phpt U php/php-src/trunk/ext/mysqli/tests/bug34810.phpt U php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt U php/php-src/trunk/ext/mysqli/tests/mysqli_connect_error.phpt U php/php-src/trunk/ext/mysqli/tests/mysqli_kill.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt 2009-12-09 10:50:10 UTC (rev 291915) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug34810.phpt 2009-12-09 12:06:10 UTC (rev 291916) @@ -55,7 +55,7 @@ [%u|b%"connect_errno"]=> int(0) [%u|b%"connect_error"]=> - %unicode|string%(0) "" + NULL [%u|b%"errno"]=> int(0) [%u|b%"error"]=> @@ -91,7 +91,7 @@ [%u|b%"connect_errno"]=> int(0) [%u|b%"connect_error"]=> - %unicode|string%(0) "" + NULL [%u|b%"errno"]=> int(0) [%u|b%"error"]=> Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt 2009-12-09 10:50:10 UTC (rev 291915) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt 2009-12-09 12:06:10 UTC (rev 291916) @@ -276,6 +276,6 @@ setting mysqli->unknown, mysqli_unknown = 'friday' Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation): -mysqli->connect_error = ''/%unicode|string% (''/%unicode|string%) +mysqli->connect_error = ''/NULL (''/NULL) mysqli->connect_errno = '0'/integer ('0'/integer) done! \ No newline at end of file Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_connect_error.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_connect_error.phpt 2009-12-09 10:50:10 UTC (rev 291915) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_connect_error.phpt 2009-12-09 12:06:10 UTC (rev 291916) @@ -21,8 +21,8 @@ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", $host, $user, $db, $port, $socket); - if ('' !== ($tmp = mysqli_connect_error())) - printf("[003] Expecting string/'', got %s/%s\n", gettype($tmp), $tmp); + if (NULL !== ($tmp = mysqli_connect_error())) + printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); mysqli_close($link); Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_kill.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_kill.phpt 2009-12-09 10:50:10 UTC (rev 291915) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_kill.phpt 2009-12-09 12:06:10 UTC (rev 291916) @@ -91,7 +91,7 @@ [%u|b%"connect_errno"]=> int(0) [%u|b%"connect_error"]=> - %unicode|string%(0) "" + NULL [%u|b%"errno"]=> int(2006) [%u|b%"error"]=> Modified: php/php-src/trunk/ext/mysqli/tests/bug34810.phpt === --- php/php-src/trunk/ext/mysqli/tests/bug34810.phpt2009-12-09 10:50:10 UTC (rev 291915) +++ php/php-src/trunk/ext/mysqli/tests/bug34810.phpt2009-12-09 12:06:10 UTC (rev 291916) @@ -55,7 +55,7 @@ [%u|b%"connect_errno"]=> int(0) [%u|b%"connect_error"]=> - %unicode|string%(0) "" + NULL [%u|b%"errno"]=> int(0) [%u|b%"error"]=> @@ -91,7 +91,7 @@ [%u|b%"connect_errno"]=> int(0) [%u|b%"connect_error"]=> - %unicode|string%(0) "" + NULL [%u|b%"errno"]=> int(0) [%u|b%"error"]=> Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt === --- php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt 2009-12-09 10:50:10 UTC (rev 291915) +++ php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt 2009-12-09 12:06:10 UTC (rev 291916) @@ -276,6 +