Bug #71941 [Opn->Ver]: Setting PDO::ATTR_ERRMODE to PDO::ERRMODE_SILENT does NOT work

From: Date: Sat, 02 Apr 2016 11:18:27 +0000
Subject: Bug #71941 [Opn->Ver]: Setting PDO::ATTR_ERRMODE to PDO::ERRMODE_SILENT does NOT work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200302@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71941&edit=1 ID: 71941 Updated by: krakjoe@php.net Reported by: belliash at asiotec dot eu dot org Summary: Setting PDO::ATTR_ERRMODE to PDO::ERRMODE_SILENT does NOT work -Status: Open +Status: Verified Type: Bug Package: PDO Core Operating System: ALL PHP Version: 7.0.5 Block user comment: N Private report: N New Comment: Looks intentional, as a strange response to a bug ... http://lxr.php.net/xref/PHP_7_0/ext/pdo/pdo_dbh.c#48 Looks like it has been like that for a long time ... not sure what to do ... Previous Comments: ------------------------------------------------------------------------ [2016-04-01 12:45:01] belliash at asiotec dot eu dot org Description: ------------ As you can see in above example (https://3v4l.org/0hf0u) I am setting PDO::ATTR_ERRMODE to PDO::ERRMODE_SILENT but somehow it does not make $pdo->getAttribute() silent. It is throwing an exception or warning, depending on setting, but it is IMPOSSIBLE to make it silent. Test script: --------------- $pdo = new \PDO('sqlite::memory:'); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_SILENT); $pdo->getAttribute(1); Expected result: ---------------- NO WARNING Actual result: -------------- Warning: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute in /in/0hf0u on line 6 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71941&edit=1

« previous php.bugs (#200302) next »