Bug #63812 [Com]: PDO Triggers Warning(s) Regardless of Error Handling Strategy

From: Date: Tue, 04 Apr 2023 23:59:37 +0000
Subject: Bug #63812 [Com]: PDO Triggers Warning(s) Regardless of Error Handling Strategy
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244103@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63812&edit=1 ID: 63812 Comment by: info at daniel-marschall dot de Reported by: sergey at shymko dot net Summary: PDO Triggers Warning(s) Regardless of Error Handling Strategy Status: No Feedback Type: Bug Package: PDO MySQL Operating System: Linux PHP Version: 5.3.19 Assigned To: cmb Block user comment: N Private report: N New Comment: Addendum: My setup: - PHP 8.2.0 - PDO, driver mysql - mysql Ver 15.1 Distrib 10.4.22-MariaDB - Windows 10 host - PDO:ATTR_ERRMODE is set to PDO:ERRMODE_SILENT I made two tests. One works as expected, the other not. First test: - Query "SELECT * from NONEXISTING" via Prepared Statement - No parameters were given in the prepared statement - GOOD: $ps->errorInfo() is ['42S02', '1146', "Table 'dbname.NONEXISTING' doesn't exist"]. - GOOD: No PHP warning is shown Second test: - Query "SELECT * from NONEXISTING" via Prepared Statement - 1 parameter was given (yes, this is clearly wrong) - BAD: $ps->errorInfo() is ['HY093', null, null] (there is no driver specific error message!) - BAD: PHP Warning is shown "Invalid parameter number: number of bound variables does not match number of tokens" - Possible error: This error message is probably accidentally output to PHP warning instead of being put into errorInfo(). Previous Comments: ------------------------------------------------------------------------ [2023-04-04 23:39:08] info at daniel-marschall dot de The bug is now 11 years old and nobody cares :-( In the latest version of PHP 8.2, PDO shows a PHP warning, even if PDO::ERRMODE_SILENT is applied. This is wrong. Silent means silent. Please fix this. ------------------------------------------------------------------------ [2020-03-22 04:22:09] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. ------------------------------------------------------------------------ [2020-03-09 17:41:52] cmb@php.net This issue is supposed to be [1] as of PHP 7.4.0. I don't think that back-porting the fix to PHP 7.3 makes much sense at this point. [1] <http://git.php.net/?p=php-src.git;a=commit;h=2856afc70e50b85424b2bd2d6653020679160a0b> ------------------------------------------------------------------------ [2019-02-27 07:29:03] moritz dot friedrich at messengerpeople dot com This bug is, as of today, more than six years old. Is there anyone on the developer team that might want to comment on it, provide some information on how to mitigate the issue or at least add a wontfix flag so we know we'll have to deal with this ourselves? ------------------------------------------------------------------------ [2018-11-09 13:17:32] jferrer at data-solutions dot com This bug is a ******* joke I don't understand how something like this is still not fixed in php 7.0.3 This is how i "fixed" it: // Convert NOTICE, WARNING, ... in Exceptions $convert_error_to_exception = function ($level, $message, $file, $line, $context=null){ throw new ErrorException($message, 0, $level, $file, $line); }; set_error_handler($convert_error_to_exception); I convert Warnings in ErrorException which makes them catchable ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=63812 -- Edit this bug report at https://bugs.php.net/bug.php?id=63812&edit=1

« previous php.bugs (#244103) next »