Bug #77572 [NEW]: Errors not shown properly

From: Date: Tue, 05 Feb 2019 21:29:31 +0000
Subject: Bug #77572 [NEW]: Errors not shown properly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219375@lists.php.net to get a copy of this message
From: ja at agares dot info Operating system: PHP version: 7.2.14 Package: PDO Core Bug Type: Bug Bug description:Errors not shown properly Description: ------------ When the driver emits a message that's not an error (like in my example). The error after that will show the previous message instead of the actual error. I reported this as a bug in the SQLSRV repo (https://github.com/Microsoft/msphpsql/issues/924). And the maintainers suggested that it's most likely an issue within PDO itself. Test script: --------------- <?php $pdo = new \PDO('sqlsrv:Server=localhost;Database=test'); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $statement = $pdo->prepare('SET NOCOUNT ON; USE test2; SELECT 1/0 AS col1'); $statement->execute(); var_dump($statement->fetchColumn()); Expected result: ---------------- An error about division by zero Actual result: -------------- PHP Fatal error: Uncaught PDOException: SQLSTATE[01000]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Changed database context to 'test2'. -- Edit bug report at https://bugs.php.net/bug.php?id=77572&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77572&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77572&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77572&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77572&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77572&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77572&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77572&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77572&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77572&r=support Expected behavior: https://bugs.php.net/fix.php?id=77572&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77572&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77572&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77572&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77572&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77572&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77572&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77572&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77572&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77572&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77572&r=mysqlcfg

« previous php.bugs (#219375) next »