#28107 [Opn->Bgs]: Weird string offset E_WARNING behaviour
| From: | pollita@php.net | Date: | Thu, 22 Apr 2004 15:20:07 +0000 |
| Subject: | #28107 [Opn->Bgs]: Weird string offset E_WARNING behaviour | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58582@lists.php.net to get a copy of this message | ||
ID: 28107
Updated by: pollita@php.net
Reported By: christian at jul dot net
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Debian Linux (sid)
PHP Version: 5.0.0RC1
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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