ID: 40850
Updated by: [EMAIL PROTECTED]
Reported By: serge dot dominici at e-sd dot org
-Status: Open
+Status: Bogus
Bug Type: MySQLi related
Operating System: win32
PHP Version: 5.2.1
New Comment:
Operator "new" cannot return FALSE by design, it creates new object.
Use mysqli_connect() function (which is actually an alias for
MySQLi::__construct()) and it works just fine.
Previous Comments:
------------------------------------------------------------------------
[2007-03-18 22:37:38] serge dot dominici at e-sd dot org
Sorry i have invert 'Expected result' and 'Actual result'
------------------------------------------------------------------------
[2007-03-18 22:35:53] serge dot dominici at e-sd dot org
Description:
------------
When creating the mysqli object, it don't return FALSE as said in the
documentation, if the connection failed.
Reproduce code:
---------------
try {
$this->mysqli = @new mysqli('localhost', 'bad_user', 'password',
'db');
if ($this->mysqli == FALSE) {
throw new Exception("Connection failed !");
}
var_dump($this->mysqli);
var_export($this->mysqli);
} catch (Exception $e) {
$e->showStackTrace();
}
Expected result:
----------------
object(mysqli)#5 (0) { } mysqli::__set_state(array( ))
Actual result:
--------------
Connection failed !
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40850&edit=1