Bug #65751 [NEW]: isset() and empty() hides illegal offset warning

From: Date: Tue, 24 Sep 2013 11:03:26 +0000
Subject: Bug #65751 [NEW]: isset() and empty() hides illegal offset warning
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-181763@lists.php.net to get a copy of this message
From: anton dot polonskiy at gmail dot com Operating system: Ubuntu 13.04 PHP version: Irrelevant Package: *General Issues Bug Type: Bug Bug description:isset() and empty() hides illegal offset warning Description: ------------ Manual says: "As of PHP 5.4 string offsets have to either be integers or integer-like strings, otherwise a warning will be thrown. Previously an offset like "foo" was silently cast to 0." That warning will suppressed by wrapping variable in isset() or empty(); http://3v4l.org/MEldp Test script: --------------- <?php $a = 'foo'; var_dump($a['bar']); // warning var_dump(empty($a['bar'])); // no warning var_dump(isset($a['bar'])); // no warning -- Edit bug report at https://bugs.php.net/bug.php?id=65751&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65751&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65751&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65751&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65751&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65751&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65751&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65751&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65751&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65751&r=support Expected behavior: https://bugs.php.net/fix.php?id=65751&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65751&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65751&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65751&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65751&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65751&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65751&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65751&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65751&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65751&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65751&r=mysqlcfg

« previous php.bugs (#181763) next »