|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39053 errorInfo not populated for connect error
Submitted: 2006-10-05 20:23 UTC Modified: 2006-10-09 16:28 UTC
From: xing at mac dot com Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5CVS-2006-10-05 (snap) OS: Linux
Private report: No CVE-ID: None
 [2006-10-05 20:23 UTC] xing at mac dot com
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)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-05 20:30 UTC]
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:38 UTC] xing at mac dot com

try {
  $link = new PDO("mysql:host=;port=99;","user","pass");

  $link->query("SET NAMES 'utf8'");
  $link->query("show slave status");
  echo "good";
catch (PDOException $e) {
  echo "<pre>";
  echo "</pre>";
 [2006-10-09 16:28 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Due to the fact connection has failed there is no context for 
the error.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 03:01:29 2024 UTC