#48235 [Opn->Csd]: Wrong datatype for PDOException::$errorInfo
| From: | kalle@php.net | Date: | Tue, 12 May 2009 15:36:10 +0000 |
| Subject: | #48235 [Opn->Csd]: Wrong datatype for PDOException::$errorInfo | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2242@lists.php.net to get a copy of this message | ||
ID: 48235
Updated by: kalle@php.net
Reported By: chsc at peytz dot dk
-Status: Open
+Status: Closed
Bug Type: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: kalle
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2009-05-11 15:39:06] 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"
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48235&edit=1