From: rodricg at sellingsource dot com Operating system: Linux PHP version: 5CVS-2006-12-27 (snap) PHP Bug Type: PDO related Bug description: PDO fails to report error
Description: ------------ With a php linked against libmysqlclient.so.15 (from mysql 5.0.30) connecting to a mysql 4.x server PDO fails to report errors. Reproduce code: --------------- <?php $pdo = new PDO('mysql:host=localhost;port=3306;dbname=mysql', 'root', ''); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "selec Host, User, Password from user"; $qry = $pdo->query($sql); $qry->setFetchMode(PDO::FETCH_OBJ); foreach($qry as $row) { print_r($row); } ?> Expected result: ---------------- Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selec Host, User, Password from user' at line 1' in /root/bug.php:6 Stack trace: #0 /root/bug.php(6): PDO->query('selec Host, Use...') #1 {main} thrown in /root/bug.php on line 6 Actual result: -------------- Fatal error: Call to a member function setFetchMode() on a non-object in /root/bug.php on line 7 -- Edit bug report at http://bugs.php.net/?id=39967&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39967&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39967&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39967&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39967&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39967&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39967&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39967&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39967&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39967&r=support Expected behavior: http://bugs.php.net/fix.php?id=39967&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39967&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39967&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39967&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39967&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39967&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39967&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39967&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39967&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39967&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39967&r=mysqlcfg