php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #48235 Wrong datatype for PDOException::$errorInfo
Submitted: 2009-05-11 15:39 UTC Modified: 2009-05-12 15:36 UTC
From: chsc at peytz dot dk Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2009-05-11 15:39 UTC] chsc at peytz dot dk
Description:
------------
According to http://www.php.net/manual/en/class.pdoexception.php,  PDOException::$errorInfo is string, but it is in fact an array (corresponding to PDO::errorInfo()) or NULL.


Reproduce code:
---------------
$sql = new PDO("mysql:host=localhost;dbname=mydb","john","secret");
$sql->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
try {
  $sql->query("INSERT INTO test.nonexistent (id) VALUES (1)");
} catch(PDOException $e) {
  var_dump($e->errorInfo);
}


Actual result:
--------------
array(3) {
  [0]=>
  string(5) "42S02"
  [1]=>
  int(1146)
  [2]=>
  string(38) "Table 'test.nonexistent' doesn't exist"
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-12 15:36 UTC] kalle@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:10 UTC] phpdocbot@php.net
Automatic comment on behalf of kalle
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=5fbc3ba3638a27bb906b53859b6bca59b3547991
Log: Fixed #48235 (Wrong datatype for PDOException::$errorInfo)
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 06:00:01 2026 UTC