|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-03-09 18:16 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2020-03-09 18:16 UTC] cmb@php.net
[2020-03-22 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 12:00:01 2025 UTC |
Description: ------------ The PHP manual states, that errors, which occur using mysqli, can be converted into exceptions by using mysqli_report. But even with corresponding settings made by using mysqli_report, \mysqli::query() is not throwing an exception but is emitting a PHP warning. This makes it very hard to handle the issue locally as the emitted PHP warning is hitting the PHP error handler instead of a local try-catch block. I am facing the issue with a mysql transaction deadlock/conflict right now, but it can be reproduced easily with an empty query, see test script and actual result. mysqli should honor the settings made by using mysqli_report for all kinds of error. Test script: --------------- <?php mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $mysqli = new \mysqli('<host>', '<user>', '<pwd>', '<database>'); // replace <host>,.. with connection settings $mysqli->query(''); Expected result: ---------------- PHP Fatal error: Uncaught mysqli_sql_exception: mysqli::query(): Empty query in /vagrant/test.php:5 Stack trace: #0 /foo/test.php(5): mysqli->query('') #1 {main} thrown in /foo/test.php on line 5 Actual result: -------------- PHP Warning: mysqli::query(): Empty query in /foo/test.php on line 5