|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-10-05 20:23 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 21:00:02 2025 UTC |
<?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>"; } ?>