|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41215 setAttribute return code reversed
Submitted: 2007-04-27 17:09 UTC Modified: 2007-04-29 14:47 UTC
From: jerry at gii dot co dot jp Assigned: iliaa (profile)
Status: Closed Package: PDO related
PHP Version: 5.2.1 OS: WinXP Home SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 + 16 = ?
Subscribe to this entry?

 [2007-04-27 17:09 UTC] jerry at gii dot co dot jp

returns FALSE on success and TRUE on failure. This is the reverse of the documentation (and counter-intuitive).

The data base server is MySQL 4.1.21-standard running on CentOS 3.

Reproduce code:
               $dbh = new PDO("mysql:host=$db_hostname;dbname=$db_name", "$db_user_name",
$r_code = $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$errmode = $dbh->getAttribute(PDO::ATTR_ERRMODE);
echo ($r_code ? "TRUE" : "FALSE") . " | " . $errmode;

Expected result:
It should echo

TRUE | 2

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-27 17:11 UTC] jerry at gii dot co dot jp
I purposely didn't show the values of the parameters for the opening of the data base, but trust me that they are correct.
 [2007-04-29 14:47 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 22 05:03:34 2022 UTC