#21820 [Opn->Ver]: bc break in parser
| From: | sniper@php.net | Date: | Thu, 23 Jan 2003 01:53:20 +0000 |
| Subject: | #21820 [Opn->Ver]: bc break in parser | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30993@lists.php.net to get a copy of this message | ||
ID: 21820
Updated by: sniper@php.net
Reported By: george@omniti.com
-Status: Open
+Status: Verified
Bug Type: Scripting Engine problem
PHP Version: 4.3.0
New Comment:
Anyone remember in what version of PHP this did work? :)
Correct (?) way to do this is:
<?php
$arr = array('foo' => 'bar');
print "{$arr['foo']}";
?>
Or at least I've started to use that just because of this bug.
Previous Comments:
------------------------------------------------------------------------
[2003-01-22 13:56:01] philip@php.net
Point was, maybe there is a reason this was not implemented.
And btw, this is a bug as 'foo' is defined yet the error says it's
not.
------------------------------------------------------------------------
[2003-01-22 13:45:54] george@omniti.com
this patch fixes that feature request/bug as well
------------------------------------------------------------------------
[2003-01-22 13:43:05] philip@php.net
Allowing it would be nice but this topic has come up many times. Not
sure why it's not been implemented though, maybe there are reasons? I
forget them.
One feature request for this:
http://bugs.php.net/bug.php?id=15677
------------------------------------------------------------------------
[2003-01-22 13:25:11] george@omniti.com
patch up at http://www2.omniti.com/~george/
zend.patch.2002012101
patch allows for "$arr['foo']" to be parsed correctly (this
seems better than disallowing it)
------------------------------------------------------------------------
[2003-01-22 09:19:20] george@omniti.com
I don't think this is a bug, but someone sent it to me via
email, so I'm proxy-submitting:
Hello George-
I stumbled upon a serious bug in the string parser and it
goes something like this:
$arr = array('foo' => 'bar');
print "$arr['foo']";
This used to provide a parse error but now instead we get
this one of level E_NOTICE:
Notice: Undefined index: 'foo' in /tmp/a.php on line 4
/tmp/a.php(4) : Notice - Undefined index: 'foo'
This is a serious problem as it moved an error from
parse to E_NOTICE, fails silently as most have error
reporting turned down, shows a misleading error as foo
is defined, and breaks BC.
Tested latest 4_3 HEAD (4.3.1-dev). I would try php5
but I get segfault when trying to compile/use it :)
Have a nice day,
Philip Olson
cc: derick
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21820&edit=1