#31303 [Opn->Bgs]: treating a string like a regular array leads to a fatal offset
| From: | derick@php.net | Date: | Sun, 26 Dec 2004 10:35:19 +0000 |
| Subject: | #31303 [Opn->Bgs]: treating a string like a regular array leads to a fatal offset | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-71078@lists.php.net to get a copy of this message | ||
ID: 31303
Updated by: derick@php.net
Reported By: schmad at miller-group dot net
-Status: Open
+Status: Bogus
Bug Type: Reproducible crash
Operating System: Mac OS X 10.3.7
PHP Version: 5.0.3
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
This is expected, and not a bug. It doesn't make sense to do this at
all either.
Previous Comments:
------------------------------------------------------------------------
[2004-12-26 08:07:14] schmad at miller-group dot net
Description:
------------
Using array functions on a string like count() or
unset() results in fatal offset errors which were not
encountered in 4.3.x code.
Reproduce code:
---------------
$link = 'bla';
unset($link['one']);
//In 4.x: No Error
$link = '';
count($link['two']);
//In 4.x: No Error
Expected result:
----------------
$link = 'bla';
unset($link['one']);
//In 4.x: No Error
$link = '';
count($link['two']);
//In 4.x: No Error
Actual result:
--------------
$link = 'bla';
unset($link['one']);
//Outputs: Fatal error: Cannot unset string offsets in
...
$link = '';
count($link['two']);
//Outputs: Fatal error: Cannot use string offset as an
array in ...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31303&edit=1