Skip to content

Commit

Permalink
Improve mysqli test 066.phpt (php#17022)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-tekiela authored Dec 10, 2024
1 parent 8ef9302 commit b47d171
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions ext/mysqli/tests/066.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ require_once 'skipifconnectfailure.inc';
/*** test mysqli_connect 127.0.0.1 ***/
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);

$mysql->query("SELECT 1/0, CAST('NULL' AS UNSIGNED)");
$i = 1;
if (($warning = $mysql->get_warnings())) {
do {
printf("Warning in strict mode $i\n");
printf("Error number: %s\n", $warning->errno);
printf("Message: %s\n", $warning->message);
$i++;
} while ($warning->next());
}

if (!mysqli_query($mysql, "SET sql_mode=''"))
printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));

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

if (($warning = $mysql->get_warnings())) {
do {
printf("Warning\n");
printf("Warning $i\n");
printf("Error number: %s\n", $warning->errno);
printf("Message: %s\n", $warning->message);
$i++;
} while ($warning->next());
}

Expand All @@ -43,5 +57,13 @@ if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
mysqli_close($link);
?>
--EXPECT--
Warning
Warning in strict mode 1
Error number: 1365
Message: Division by 0
Warning in strict mode 2
Error number: 1292
Message: Truncated incorrect INTEGER value: 'NULL'
Warning 3
Error number: 1048
Message: Column 'a' cannot be null
done!

0 comments on commit b47d171

Please sign in to comment.