[php-src] Issue #8148: mysqli_query returns fatal error when table in query doesn't exist

From: Date: Thu, 24 Feb 2022 03:17:42 +0000
Subject: [php-src] Issue #8148: mysqli_query returns fatal error when table in query doesn't exist
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240002@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8148 Author: phaedrus428 ### 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 <?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_

« previous php.bugs (#240002) next »