|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2004-04-22 17:20 UTC] pollita@php.net
  [2004-04-27 03:36 UTC] aaron dot hawley at uvm dot edu
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Thu Oct 30 15:00:01 2025 UTC | 
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