Bug #51818 [NEW]: var_dump(): Couldn't fetch mysqli

From: Date: Fri, 14 May 2010 01:47:55 +0000
Subject: Bug #51818 [NEW]: var_dump(): Couldn't fetch mysqli
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150449@lists.php.net to get a copy of this message
From:             
Operating system: Linux
PHP version:      5.3.2
Package:          MySQLi related
Bug Type:         Bug
Bug description:var_dump(): Couldn't fetch mysqli

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 bug report at http://bugs.php.net/bug.php?id=51818&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=51818&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=51818&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=51818&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=51818&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51818&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=51818&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=51818&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=51818&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=51818&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=51818&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=51818&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=51818&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=51818&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=51818&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51818&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51818&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=51818&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=51818&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=51818&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=51818&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=51818&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#150449) next »