Bug #81037 [NEW]: PDO discards error message text from prepared statement

From: Date: Thu, 13 May 2021 12:45:13 +0000
Subject: Bug #81037 [NEW]: PDO discards error message text from prepared statement
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233821@lists.php.net to get a copy of this message
From: dharman Operating system: PHP version: Irrelevant Package: PDO MySQL Bug Type: Bug Bug description:PDO discards error message text from prepared statement Description: ------------ When executing a prepared statement in non-emulated mode PDO reports an error, but only with the code without the actual error message text. Test script: --------------- <?php $pdo = new \PDO("mysql:host=localhost;dbname=test;charset=utf8mb4", 'user', 'password', [ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_EMULATE_PREPARES => false ]); $sql = "SELECT foo FROM bar WHERE foo = :par"; $stmt = $pdo->prepare($sql); $stmt->execute(); $data = $stmt->fetchAll(PDO::FETCH_ASSOC); Expected result: ---------------- Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2031 No data supplied for parameters in prepared statement in Actual result: -------------- Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2031 in // Notice the text is missing between error code and the "in" -- Edit bug report at https://bugs.php.net/bug.php?id=81037&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81037&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81037&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81037&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81037&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81037&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81037&r=support Expected behavior: https://bugs.php.net/fix.php?id=81037&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81037&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81037&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81037&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81037&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81037&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81037&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81037&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81037&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81037&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81037&r=mysqlcfg

« previous php.bugs (#233821) next »