Edit report at http://bugs.php.net/bug.php?id=51818&edit=1
ID: 51818 Updated by: and...@php.net Reported by: zeusgerde at arcor dot de Summary: var_dump(): Couldn't fetch mysqli -Status: Open +Status: Wont fix Type: Bug Package: MySQLi related Operating System: Linux PHP Version: 5.3.2 -Assigned To: +Assigned To: mysql New Comment: I think this is a won't fix. The properties of the mysqli or mysql_result object are invalid if the connection establishment or the connection is closed. In case of mysql_result is something wrong happens. The extension needs different design, new mysqli(...) tries to connect, if something wrong happens it should throw an exception, it doesn't now. The design can't be changed that easily in a minor release. Previous Comments: ------------------------------------------------------------------------ [2010-05-14 03:47:55] zeusgerde at arcor dot de Description: ------------ E_WARNING when accessing properties or methods of MySQLi object if connection fails I know other people already reported this kind of issue: http://bugs.php.net/bug.php?id=33635 http://bugs.php.net/bug.php?id=34828 http://bugs.php.net/bug.php?id=36949 http://bugs.php.net/bug.php?id=45935 http://bugs.php.net/bug.php?id=45940 http://bugs.php.net/bug.php?id=50772 though I think telling the user "couldn't fetch *mysqli*" is just wrong because PHP is able to use the MySQLi object and even some of its properties or methods (e.g. MySQLi::$client_version or MySQLi::$connect_errno) i am not sure if this is a real bug report or may be a feature request. but I think it would help other people if the warning says something like "mysqli is not connected" or may be E_WARNING should not be raised at all. -- PHP 5.3.2 (cli) (built: May 14 2010 03:25:13) MySQLi Client API library version 5.1.45 Test script: --------------- <?php error_reporting(E_ALL); // not bug related ini_set('display_errors', 1); // not bug related $foo = new MySQLi('localhost', 'root', 'wrongpassword'); // alternative to the line above, same result: $foo = new MySQLi(); var_dump($foo); ?> Expected result: ---------------- object(mysqli)#1 (17) { /* ... */ } Actual result: -------------- Lots of "Warning: var_dump(): Couldn't fetch mysqli in [...]" (for nearly every single key in mysqli) object(mysqli)#1 (17) { /* content as expected */ } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51818&edit=1