ID: 28107 Comment by: aaron dot hawley at uvm dot edu Reported By: christian at jul dot net Status: Bogus Bug Type: Arrays related Operating System: Debian Linux (sid) PHP Version: 5.0.0RC1 New Comment:
Why does it only happen with only three or more indexes specified to a variable and not two or one!? Previous Comments: ------------------------------------------------------------------------ [2004-04-22 17:20:06] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. So don't do that. ------------------------------------------------------------------------ [2004-04-22 13:35:44] christian at jul dot net Description: ------------ The fact that PHP5 issues an E_WARNING on illegal string offset use, gives a problem on checking values with isset and is_array. Furthermore it does not behave consistent. Might not be a real bug, since it is the 'Backward Incompatible Changes' list, still the behavior seems to buggy to me. Reproduce code: --------------- test.php: <?php $a = 'this is not an array'; if(isset($a['foo'])) print '1'; if(isset($a['foo']['bar'])) print '2'; if(isset($a['foo']['bar']['doo'])) print '3'; ?> test2.php <?php $a = 'this is not an array'; if(is_array($a['foo'])) print '1'; if(is_array($a['foo']['bar'])) print '2'; if(is_array($a['foo']['bar']['doo'])) print '3'; ?> Expected result: ---------------- Nothing! Maybe fatal error at line 4 in both scripts, would be ok, but not very niced designed, and doesn't fit well into the type loose scheme of PHP. IMHO. Actual result: -------------- Fatal error: Cannot use string offset as an array in /var/www/sites/test.php on line 8 Fatal error: Cannot use string offset as an array in /var/www/sites/test2.php on line 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28107&edit=1