Skip to content

Improve mysqli test 066.phpt #17022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!
Loading