[php-src] Issue #20968: mysqli::options does not respect error reporting configuration

From: Date: Sun, 18 Jan 2026 20:14:56 +0000
Subject: [php-src] Issue #20968: mysqli::options does not respect error reporting configuration
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251566@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20968 Author: morozov ### Description The following code: ```php <?php $mysqli = new mysqli(); $value = $mysqli->options(-1, 'invalid_option'); var_dump($value); ``` Resulted in this output: ``` bool(false) ``` But I expected this output instead: ``` mysqli_sql_exception ``` Per the [mysqli::options documentation](https://www.php.net/manual/en/mysqli.options.php), > If mysqli error reporting is enabled > (**[MYSQLI_REPORT_ERROR](https://www.php.net/manual/en/mysqli.constants.php#constant.mysqli-report-error)**) > and the requested operation fails, a warning is generated. If, in addition, the mode is set > to **[MYSQLI_REPORT_STRICT](https://www.php.net/manual/en/mysqli.constants.php#constant.mysqli-report-strict)**, > a [mysqli_sql_exception](https://www.php.net/manual/en/class.mysqli-sql-exception.php) is thrown > instead. Per the [mysqli_driver::$report_mode documentation](https://www.php.net/manual/en/mysqli-driver.report-mode.php), this should be the default behavior: > PHP 8.1. The default value is now MYSQLI_REPORT_ERROR | > MYSQLI_REPORT_STRICT. Previously, it > was **[MYSQLI_REPORT_OFFĺ±òì > ®�Æed�`V](https://www.php.net/manual/en/mysqli.constants.php#constant.mysqli-report-off)**. For reference, mysqli::set_charset behaves as expected: ```php <?php $mysqli = new mysqli('127.0.0.1', 'root', 'Passw0rd!'); try { $mysqli->set_charset('garbage'); } catch (mysqli_sql_exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } // Caught exception: Invalid character set was provided ``` ### PHP Version ```plain PHP 8.5.2 (cli) (built: Jan 13 2026 21:40:53) (NTS) Copyright (c) The PHP Group Built by Shivam Mathur Zend Engine v4.5.2, Copyright (c) Zend Technologies with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans with Zend OPcache v8.5.2, Copyright (c), by Zend Technologies ``` ### Operating System macOS

« previous php.bugs (#251566) next »