From: morrisdavidd at gmail dot com Operating system: Linux PHP version: 5.2.6 PHP Bug Type: PDO related Bug description: PDOStatement->execute() returns true then false for same statement
Description: ------------ The query is the exact same every time the statement is called. There are no parameters being bound. However, the function only returns true the first time the PDO->execute() is called. As per: http://us3.php.net/manual/en/pdostatement.execute.php "Return Values Returns TRUE on success or FALSE on failure." I've run a test where I had it sleep after the first $stmt->execute() long enough for me to change the value of the data being selected from the database (And I output the data being selected to make sure it was retrieved in its changed form the second time around). It still returned FALSE. However, the documentation for the function states: "Execute the prepared statement." ... "Returns TRUE on success or FALSE on failure." So, the function returns FALSE when it executed the prepared statement successfully. Reproduce code: --------------- Obviously You'll have to change the database name, user, pass, table... <?php $table = "SystemInformation"; $pdoDb = new PDO("mysql:host=localhost;dbname=eta_manybodystate", DB_USER, DB_PWD); $stmt = $pdoDb->prepare("SELECT * FROM `".$table."` LIMIT 1;"); $foo = $stmt->execute(); $stmt->closeCursor(); echo "foo: "; var_dump($foo); $bar = $stmt->execute(); $stmt->closeCursor(); echo "bar: "; var_dump($bar); $foo2 = $stmt->execute(); $stmt->closeCursor(); echo "foo2: "; var_dump($foo2); $bar2 = $stmt->execute(); $stmt->closeCursor(); echo "bar2: "; var_dump($bar2); ?> Expected result: ---------------- foo: bool(true) bar: bool(true) foo2: bool(true) bar2: bool(true) Actual result: -------------- foo: bool(true) bar: bool(false) foo2: bool(false) bar2: bool(false) -- Edit bug report at http://bugs.php.net/?id=45120&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45120&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45120&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45120&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45120&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45120&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45120&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45120&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45120&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45120&r=support Expected behavior: http://bugs.php.net/fix.php?id=45120&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45120&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45120&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45120&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45120&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45120&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45120&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45120&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45120&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45120&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45120&r=mysqlcfg
