#32522 [Bgs]: String offsets REALLY weird
| From: | php at alterego dot dp dot ua | Date: | Thu, 31 Mar 2005 20:05:01 +0000 |
| Subject: | #32522 [Bgs]: String offsets REALLY weird | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-76133@lists.php.net to get a copy of this message | ||
ID: 32522
User updated by: php at alterego dot dp dot ua
Reported By: php at alterego dot dp dot ua
Status: Bogus
Bug Type: Strings related
Operating System: FreeBSD 4.10
PHP Version: 5.0.3
New Comment:
I do not expect PHP5 to be PHP4. I just expect it to be consistent in
some way.
Would you please be so kind as to give me a gentle hint of what is
wrong with $a{0}{0} (CURLY BRACES).
Thanks!
Previous Comments:
------------------------------------------------------------------------
[2005-03-31 21:56:04] sniper@php.net
If it worked in PHP4, it doesn't mean it will work in PHP 5 where it's
behaving like it should have behaved in PHP 4 too..
And $a[0][0] is not same as when you assign it first..
------------------------------------------------------------------------
[2005-03-31 21:49:15] php at alterego dot dp dot ua
Description:
------------
Strings offsets in PHP5 are broken strangely. Seems like repeated
offsets are not allowed at all, even at the times where they make good
sense.
I see nothing fatal in $a[0][0] or even $a{0}{0} or even $a[0]{0}[0] if
$a is a non-empty string. And PHP5 just crashes at any one of them.
Why $a{0} can't be a string without extra intermediate assignment?
Please, look at the code before marking bogus.
Reproduce code:
---------------
<?
$a = '0';
$b = $a[0];
echo $b[0];
$a = '0';
// leave any one line of the next few
echo $a[0][0];
echo $a[0]{0};
echo $a{0}{0};
echo $a[0]{0}[0];
?>
Expected result:
----------------
00
Actual result:
--------------
0
Fatal error: Cannot use string offset as an array in /www/test.php on
line 8
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32522&edit=1