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: -
Votes:3
Avg. Score:3.3 ± 1.2
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: ja at agares dot info Assigned:
Status: Open Package: PDO Core
PHP Version: 7.2.14 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Feb 23 00:01:25 2019 UTC