Bug #58514 [Opn->Csd]: PDO attributes ignored when passed in constructor
| From: | adambaratz@php.net | Date: | Mon, 10 Apr 2017 21:15:28 +0000 |
| Subject: | Bug #58514 [Opn->Csd]: PDO attributes ignored when passed in constructor | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208460@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=58514&edit=1
ID: 58514
Updated by: adambaratz@php.net
Reported by: rcrowell at nextjump dot com
Summary: PDO attributes ignored when passed in constructor
-Status: Open
+Status: Closed
Type: Bug
Package: PDO DBlib
Operating System: RedHat el5
PHP Version: 5.1.6
-Assigned To:
+Assigned To: adambaratz
Block user comment: N
Private report: N
New Comment:
This issue isn't present in the latest version of PDO.
Previous Comments:
------------------------------------------------------------------------
[2009-01-20 20:05:02] rcrowell at nextjump dot com
This seems to impact all attributes, not just ATTR_ERRMODE. I wrote code to set ATTR_CASE and the
same behavior was noted (attributes aren't set when passed into the constructor, but are set
when setAttribute is used).
------------------------------------------------------------------------
[2009-01-20 19:03:25] rcrowell at nextjump dot com
Description:
------------
The PDO driver ignores the ATTR_ERRMODE attribute when it is
passed in via the constructor. Exceptions are thrown
correctly when attributes are set via setAttribute().
Reproduce code:
---------------
$connection = new PDO($url, $username, $password, array(PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION));
$connection->prepare("SELECT 10 +");
$query->execute();
Expected result:
----------------
Exception thrown.
Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000]: General error: 20018 Incorrect syntax near
'+'. [20018] (severity 5) [(null)]'
Actual result:
--------------
No exception thrown.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=58514&edit=1