uw Tue, 08 Jun 2010 14:29:05 +0000
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.phpt 2010-06-08 13:48:02 UTC
(rev 300278)
+++ php/php-src/trunk/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/trunk/ext/mysqli/tests/bug50772.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/bug50772.phpt 2010-06-08 13:48:02 UTC
(rev 300278)
+++ php/php-src/trunk/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 {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php