#41215 [Opn]: setAttribute return code reversed

From: Date: Fri, 27 Apr 2007 17:11:29 +0000
Subject: #41215 [Opn]: setAttribute return code reversed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112010@lists.php.net to get a copy of this message
ID: 41215 User updated by: jerry at gii dot co dot jp Reported By: jerry at gii dot co dot jp Status: Open Bug Type: PDO related Operating System: WinXP Home SP2 PHP Version: 5.2.1 New Comment: I purposely didn't show the values of the parameters for the opening of the data base, but trust me that they are correct. Previous Comments: ------------------------------------------------------------------------ [2007-04-27 17:09:13] jerry at gii dot co dot jp Description: ------------ dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION) 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: --------------- <?php $dbh = new PDO("mysql:host=$db_hostname;dbname=$db_name", "$db_user_name", "$db_user_pass"); $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: -------------- FALSE | 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41215&edit=1

« previous php.bugs (#112010) next »