Edit report at https://bugs.php.net/bug.php?id=65751&edit=1
ID: 65751 Updated by: m...@php.net Reported by: anton dot polonskiy at gmail dot com Summary: isset() and empty() hides illegal offset warning -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Ubuntu 13.04 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2013-09-24 11:03:26] anton dot polonskiy at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=65751&edit=1