#28156 [NEW]: E_WARN instead E_ERROR when doing $a = 'asdf'; echo is_array($a['foo']['asdf']

From: Date: Mon, 26 Apr 2004 13:18:52 +0000
Subject: #28156 [NEW]: E_WARN instead E_ERROR when doing $a = 'asdf'; echo is_array($a['foo']['asdf']
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58781@lists.php.net to get a copy of this message
From: info at gramba dot tv Operating system: debian PHP version: 5CVS-2004-04-26 (dev) PHP Bug Type: Feature/Change Request Bug description: E_WARN instead E_ERROR when doing $a = 'asdf'; echo is_array($a['foo']['asdf'] Description: ------------ $a = 'asdf'; echo is_array($a['foo']['asdf']); is completly invalid, unfortunatly many applications deal with the fact that some offsets simply "may" not exist. workaround would be if (isset($a['foo']['asdf']) && is_array($a['foo']['asdf']) { .... but this would bloat the code a lot Reproduce code: --------------- // /* E_ERROR Invalid offset */ $a = 'asdf'; echo is_array($a['foo']['asdf']); Expected result: ---------------- an E_WARNING instead of E_ERROR which is suppressable Actual result: -------------- E_ERROR -- Edit bug report at http://bugs.php.net/?id=28156&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28156&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28156&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28156&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28156&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28156&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28156&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28156&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28156&r=support Expected behavior: http://bugs.php.net/fix.php?id=28156&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28156&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28156&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28156&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28156&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28156&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28156&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28156&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28156&r=float

« previous php.bugs (#58781) next »