|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28107 Weird string offset E_WARNING behaviour
Submitted: 2004-04-22 13:35 UTC Modified: 2004-04-22 17:20 UTC
From: christian at jul dot net Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.0.0RC1 OS: Debian Linux (sid)
Private report: No CVE-ID: None
 [2004-04-22 13:35 UTC] christian at jul dot net
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:
$a = 'this is not an array';

     print '1';
     print '2';
     print '3';


$a = 'this is not an array';

     print '1';
     print '2';
     print '3';


Expected result:

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-22 17:20 UTC]
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 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-27 03:36 UTC] aaron dot hawley at uvm dot edu
Why does it only happen with only three or more indexes specified to a variable and not two or one!?
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Dec 03 11:03:36 2021 UTC