From: Ulf Wendel Date: Tue, 8 Jun 2010 14:29:05 +0000 (+0000) Subject: Portability improvements X-Git-Tag: php-5.3.3RC1~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e5ac35bd9ddb6c12ccf0c9d20f5d3336444d348;p=php Portability improvements --- diff --git a/ext/mysqli/tests/bug34810.phpt b/ext/mysqli/tests/bug34810.phpt index 998d9f015b..35eb717534 100644 --- a/ext/mysqli/tests/bug34810.phpt +++ b/ext/mysqli/tests/bug34810.phpt @@ -24,7 +24,24 @@ class DbConnection { $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 @@ object(mysqli)#%d (%d) { [%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 diff --git a/ext/mysqli/tests/bug50772.phpt b/ext/mysqli/tests/bug50772.phpt index 4724d0f29e..eecef84ad2 100644 --- a/ext/mysqli/tests/bug50772.phpt +++ b/ext/mysqli/tests/bug50772.phpt @@ -12,7 +12,7 @@ require_once('skipifconnectfailure.inc'); // 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 @@ require_once('skipifconnectfailure.inc'); $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 {