#40850 [Opn]: The connection to a MySQL Server don't return FALSE if the connection failed.

From: Date: Sun, 18 Mar 2007 22:37:38 +0000
Subject: #40850 [Opn]: The connection to a MySQL Server don't return FALSE if the connection failed.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110487@lists.php.net to get a copy of this message
ID: 40850 User updated by: serge dot dominici at e-sd dot org Reported By: serge dot dominici at e-sd dot org Status: Open Bug Type: MySQLi related Operating System: win32 PHP Version: 5.2.1 New Comment: Sorry i have invert 'Expected result' and 'Actual result' Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#110487) next »