Skip to content

Commit b47d171

Browse files
Improve mysqli test 066.phpt (#17022)
1 parent 8ef9302 commit b47d171

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

ext/mysqli/tests/066.phpt

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ require_once 'skipifconnectfailure.inc';
1313
/*** test mysqli_connect 127.0.0.1 ***/
1414
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
1515

16+
$mysql->query("SELECT 1/0, CAST('NULL' AS UNSIGNED)");
17+
$i = 1;
18+
if (($warning = $mysql->get_warnings())) {
19+
do {
20+
printf("Warning in strict mode $i\n");
21+
printf("Error number: %s\n", $warning->errno);
22+
printf("Message: %s\n", $warning->message);
23+
$i++;
24+
} while ($warning->next());
25+
}
26+
1627
if (!mysqli_query($mysql, "SET sql_mode=''"))
1728
printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
1829

@@ -24,7 +35,10 @@ require_once 'skipifconnectfailure.inc';
2435

2536
if (($warning = $mysql->get_warnings())) {
2637
do {
27-
printf("Warning\n");
38+
printf("Warning $i\n");
39+
printf("Error number: %s\n", $warning->errno);
40+
printf("Message: %s\n", $warning->message);
41+
$i++;
2842
} while ($warning->next());
2943
}
3044

@@ -43,5 +57,13 @@ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
4357
mysqli_close($link);
4458
?>
4559
--EXPECT--
46-
Warning
60+
Warning in strict mode 1
61+
Error number: 1365
62+
Message: Division by 0
63+
Warning in strict mode 2
64+
Error number: 1292
65+
Message: Truncated incorrect INTEGER value: 'NULL'
66+
Warning 3
67+
Error number: 1048
68+
Message: Column 'a' cannot be null
4769
done!

0 commit comments

Comments
 (0)