#45940 [Csd]: MySQLI OO does not populate connect_error property on failed connect
| From: | danielc@php.net | Date: | Fri, 13 Mar 2009 22:55:19 +0000 |
| Subject: | #45940 [Csd]: MySQLI OO does not populate connect_error property on failed connect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134686@lists.php.net to get a copy of this message | ||
ID: 45940
Updated by: danielc@php.net
Reported By: talmage dot news at gmail dot com
Status: Closed
Bug Type: MySQLi related
Operating System: Centos 5
PHP Version: 5.2.6
Assigned To: mysql
New Comment:
Added information to the documentation.
Previous Comments:
------------------------------------------------------------------------
[2009-02-17 10:41:59] johannes@php.net
Fixed in 5.2 CVS, too, now.
------------------------------------------------------------------------
[2009-01-12 12:56:23] johannes@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2009-01-10 10:23:30] nullhility at gmail dot com
Getting the same error with the following version:
PHP 5.2.4-2ubuntu5.4 with Suhosin-Patch 0.9.6.2
I was attempting to suppress errors so I could control
output/formatting etc. Thought i'd just re-iterate this for version
related purposes.
<?php
//a forced username/password mismatch
$dbo = @new mysqli('localhost', 'r00t', 'pass', 'my_db');
var_dump($dbo->connect_error);
var_dump(mysqli_connect_error());
?>
output:
Warning: main(): Couldn't fetch mysqli in /home/default/php/mysqli.php
on line 4
NULL
string(63) "Access denied for user 'r00t'@'localhost' (using password:
YES)"
------------------------------------------------------------------------
[2008-12-25 21:17:22] ws at develtheory dot com
Was able to reproduce the error in the same method on php 5.2.8, both
with purposeful incorrect passwords and nonexistent host/port combos.
the object is created, connect_error returns NULL on var_dump, error
log dumps:
"Dec 25 15:12:18 dev01 httpd: PHP Warning: dbo::__construct() [<a
href='dbo.--construct'>dbo.--construct</a>]: Couldn't fetch mysqli in
/nfs/beta/www/classes/dbo-new.inc.php on line 88"
------------------------------------------------------------------------
[2008-12-01 13:39:16] dannyrjohnston at msn dot com
Forget my previous comment. I found some code between the new mysqli
statement in the example I was using which was setting the $dbObj to
false if mysql_connect_error was returning a value.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/45940
--
Edit this bug report at http://bugs.php.net/?id=45940&edit=1