|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77572 Errors not shown properly
Submitted: 2019-02-05 21:29 UTC Modified: 2021-04-21 11:28 UTC
Avg. Score:3.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: ja at agares dot info Assigned:
Status: Verified Package: PDO ODBC
PHP Version: 7.2.14 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-02-05 21:29 UTC] ja at agares dot info
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 ( And the maintainers suggested that it's most likely an issue within PDO itself.

Test script:
	$pdo = new \PDO('sqlsrv:Server=localhost;Database=test');
	$statement = $pdo->prepare('SET NOCOUNT ON; USE test2; SELECT 1/0 AS col1');

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'.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-21 11:28 UTC]
-Status: Open +Status: Verified -Package: PDO Core +Package: PDO ODBC
 [2021-04-21 11:28 UTC]
I can confirm this issue, but that isn't a PDO Core issue, but
rather specific to PDO ODBC.  Bug #78196 is closely related.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 18:01:30 2024 UTC