Bug #77572 [Opn->Ver]: Errors not shown properly

From: Date: Wed, 21 Apr 2021 11:28:06 +0000
Subject: Bug #77572 [Opn->Ver]: Errors not shown properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233535@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77572&edit=1 ID: 77572 Updated by: cmb@php.net Reported by: ja at agares dot info Summary: Errors not shown properly -Status: Open +Status: Verified Type: Bug -Package: PDO Core +Package: PDO ODBC PHP Version: 7.2.14 Block user comment: N Private report: N New Comment: I can confirm this issue, but that isn't a PDO Core issue, but rather specific to PDO ODBC. Bug #78196 is closely related. Previous Comments: ------------------------------------------------------------------------ [2019-02-05 21:29:31] ja at agares dot info 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 this bug report at https://bugs.php.net/bug.php?id=77572&edit=1

« previous php.bugs (#233535) next »