#39053 [Fbk->Opn]: errorInfo not populated for connect error
| From: | xing at mac dot com | Date: | Thu, 05 Oct 2006 20:38:11 +0000 |
| Subject: | #39053 [Fbk->Opn]: errorInfo not populated for connect error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103166@lists.php.net to get a copy of this message | ||
ID: 39053
User updated by: xing at mac dot com
Reported By: xing at mac dot com
-Status: Feedback
+Status: Open
Bug Type: PDO related
Operating System: Linux
PHP Version: 5CVS-2006-10-05 (snap)
New Comment:
<?php
try {
$link = new PDO("mysql:host=127.0.0.1;port=99;","user","pass");
$link->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$link->setAttribute (PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, TRUE);
$link->query("SET NAMES 'utf8'");
$link->query("show slave status");
echo "good";
}
catch (PDOException $e) {
echo "<pre>";
print_r($e);
echo "</pre>";
}
?>
Previous Comments:
------------------------------------------------------------------------
[2006-10-05 20:30:46] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2006-10-05 20:23:10] xing at mac dot com
Description:
------------
When pdo connect fails, the pdoexception object field "errorInfo" is
properly set.
Mysql 5.0.24a
PHP 5.2snap
Reproduce code:
---------------
Use pdo to a non-existing mysql server. Catch and print_r() exception.
Expected result:
----------------
...pdo exception snippet...
[errorInfo] => Array
(
[0] => HY000
[1] => 2003
[2] => Can't connect to MySQL server on '1276.0.0.86'
(111)
)
Actual result:
--------------
[errorInfo] =>
(empty errorInfo property)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39053&edit=1