php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71941 Setting PDO::ATTR_ERRMODE to PDO::ERRMODE_SILENT does NOT work
Submitted: 2016-04-01 12:45 UTC Modified: 2017-10-24 08:31 UTC
Votes:3
Avg. Score:2.3 ± 0.9
Reproduced:0 of 1 (0.0%)
From: belliash at asiotec dot eu dot org Assigned:
Status: Verified Package: PDO related
PHP Version: 7.0.5 OS: ALL
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: belliash at asiotec dot eu dot org
New email:
PHP Version: OS:

 

 [2016-04-01 12:45 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-02 11:18 UTC] krakjoe@php.net
-Status: Open +Status: Verified
 [2016-04-02 11:18 UTC] krakjoe@php.net
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 ...
 [2016-04-02 14:49 UTC] belliash at asiotec dot eu dot org
IMHO this is a bug. The behaviour is way different than specified in documentation and thus should be fixed in my opinion.
 [2017-10-24 08:31 UTC] kalle@php.net
-Package: PDO Core +Package: PDO related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 02:01:26 2019 UTC