From: Operating system: Linux 2.6.32-5-amd64 PHP version: 5.4.0 Package: PDO related Bug Type: Bug Bug description:PDOStatement::errorInfo returning NULL for driver code and message
Description: ------------ While using not emulated prepared statement against MySQL 5.5, warnings (using ERRMODE_WARNING) are more verbose than errorInfo(). With prepared queries, errorInfo return (string, NULL, NULL). This fact is true with or without ERRMODE_WARNING. And this fact is also true, but different while using standard queries : What the warning give me : {{{ [WARNING] PDO::query() [<a href='pdo.query'>pdo.query</a>]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '83-27 7727' for key 'UNIQUE' }}} What I got from errorInfo()[2] (Missing the "Integrity constraint violation:" string, built client side from error code ?) : {{{ Duplicate entry '83-277727' for key 'UNIQUE' }}} Test script: --------------- <?php class My_PDOStatement extends PDOStatement { public function execute($input_parameters = NULL) { $res = parent::execute($input_parameters); if ($res === FALSE) var_dump($this->errorInfo()); return $res; } } $options = array(PDO::ATTR_PERSISTENT => FALSE, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING, PDO::ATTR_EMULATE_PREPARES => FALSE, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_STATEMENT_CLASS => array('My_PDOStatement')); $pdo = new PDO(...); $stmt = $pdo->prepare("SELECT :a + :a"); $stmt->execute(array('a' => 1)); // Willingly generate 'Invalid parameter number' var_dump($stmt->fetchAll()); Expected result: ---------------- I Expect errorInfo() to return error messages. Actual result: -------------- errorInfo() in this specific case return (string, NULL, NULL). -- Edit bug report at https://bugs.php.net/bug.php?id=61516&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61516&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61516&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61516&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61516&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61516&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61516&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61516&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61516&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61516&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61516&r=support Expected behavior: https://bugs.php.net/fix.php?id=61516&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61516&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61516&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61516&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61516&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61516&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61516&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61516&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61516&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61516&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61516&r=mysqlcfg