php.net |  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
Votes:3
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ja at agares dot info
New email:
PHP Version: OS:

 

 [2019-02-05 21:29 UTC] 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'.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-21 11:28 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: PDO Core +Package: PDO ODBC
 [2021-04-21 11:28 UTC] cmb@php.net
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: Thu Nov 21 17:01:32 2024 UTC