php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36222 errorInfo in PDOException is always NULL
Submitted: 2006-01-31 10:40 UTC Modified: 2006-01-31 18:21 UTC
From: traufeisen@php.net Assigned: wez (profile)
Status: Closed Package: PDO related
PHP Version: 5.1.2 OS: CentOS 4
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: traufeisen@php.net
New email:
PHP Version: OS:

 

 [2006-01-31 10:40 UTC] traufeisen@php.net
Description:
------------
If PDO is using ERRMODE_EXCEPTION, the errorInfo property of PDOException is not filled with the driver specific errorinformation.

A patch is available at http://www.phpschlampe.de/pdo_dbh.patch

Reproduce code:
---------------
<?php
$sql    =   new PDO         ("mysql:host=localhost;dbname=test","foo","bar");
$sql    ->  setAttribute    (PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
try{
    $sql    ->  query           ("INSERT INTO test.nonexistent (id) VALUES (1)");
}catch(PDOException $e){
    echo $e->getMessage();
    print_r($e->errorInfo);
}
?>

Expected result:
----------------
Output of the errormessage and a filled errorInfo-Array

Actual result:
--------------
errormessage is ok, but errorInfo is NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-31 18:21 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Apr 13 01:01:29 2025 UTC