ID: 39967 Updated by: [EMAIL PROTECTED] Reported By: rodricg at sellingsource dot com -Status: Open +Status: Feedback Bug Type: PDO related Operating System: Linux PHP Version: 5CVS-2006-12-27 (snap) New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Seems to work fine in latest CVS Previous Comments: ------------------------------------------------------------------------ [2006-12-27 22:14:17] rodricg at sellingsource dot com 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 this bug report at http://bugs.php.net/?id=39967&edit=1