From: djneoform at gmail dot com
Operating system: Win2k3 Standard
PHP version: 5.2.6
PHP Bug Type: MySQLi related
Bug description: Failed Connect Does Not Return FALSE
Description:
------------
When a mysqli connection fails, the returned value is an empty mysqli
object and not a bool(FALSE), this means any tests on the connection will
not work, eg: if ($conn) { ... }
When the documentation: http://ca.php.net/manual/en/mysqli.connect.php
States:
"Return Values
Returns a object which represents the connection to a MySQL Server or
FALSE if the connection failed."
Reproduce code:
---------------
<?php
$connection = new mysqli('localhost', 'badinfo', 'badinfo', 'badinfo');
var_dump($connection);
?>
Expected result:
----------------
bool(FALSE)
Actual result:
--------------
object(mysqli)#1 (0) { }
--
Edit bug report at http://bugs.php.net/?id=45646&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45646&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45646&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45646&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45646&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45646&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45646&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45646&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45646&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45646&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45646&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45646&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45646&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45646&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45646&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45646&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45646&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45646&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45646&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45646&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45646&r=mysqlcfg