-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
Description
Description
The mysqli_query function (https://www.php.net/manual/en/mysqli.query.php) is no longer returning false when the table does not exist. In PHP 8.0.16, false is returned, but in PHP 8.1.0 and PHP 8.1.3, a fatal error is received instead. The documentation does not say to expect this change.
Sample code:
<?php
$link = mysqli_connect($database_host, $database_username,
$database_password, $database_name, $database_port, $database_socket);
if ($link && mysqli_select_db($link, $database_name) {
$query = "SELECT userID FROM `users`";
$result = mysqli_query($link, $query);
} else {
echo "Connection Error";
exit();
}
?>
That results in a fatal error if the table doesn't exist, but mysqli_query should simply return false in that case.
PHP Version
PHP 8.1.0 and 8.1.3
Operating System
No response