#21820 [Asn->Ctl]: [CRITICAL] "$arr['foo']" generates bogus E_NOTICE, bc break

From: Date: Fri, 25 Apr 2003 06:14:19 +0000
Subject: #21820 [Asn->Ctl]: [CRITICAL] "$arr['foo']" generates bogus E_NOTICE, bc break
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38347@lists.php.net to get a copy of this message
ID: 21820 Updated by: sniper@php.net Reported By: george at omniti dot com -Status: Assigned +Status: Critical Bug Type: Scripting Engine problem PHP Version: 4.3.2-RC1 Assigned To: andi New Comment: de-assign. :) Previous Comments: ------------------------------------------------------------------------ [2003-04-23 02:34:07] sniper@php.net It's been couple of weeks (almost :) since Andi promised to fix this..maybe this will wake him up.. ------------------------------------------------------------------------ [2003-03-13 14:05:48] philip@php.net This still provides a bogus E_NOTICE, which is the bug. The feature request of "$arr['foo']" working is #15677 not #21820 To simply fix the bug, 4.3.2 should provide a parse error just like 4.2.3 does. A/the discussion took place on the zend2 mailing list, which can be seen around here: http://www.zend.com/lists/engine2/200302/maillist.html Thread title: "[Zend Engine 2] fix for bug 21820" ------------------------------------------------------------------------ [2003-02-25 04:50:31] sniper@php.net Stig's reply on the mailing list: Take consistency further, and you wonder should "'a'" === "a"? No, so why should "$foo['a']" === "$foo[a]"? The index is already quoted, it's inside the string. The syntax we're talking about here is supposed to be straightforward and simple, and for any kind of tricks we recommend the "{$foo['a']}" syntax. IMHO this would bloat the syntax beyond straightforward. -------- Thus we better keep it like it is now -> wont fix. ------------------------------------------------------------------------ [2003-02-13 13:04:39] gschlossnagle@php.net I still maintain that the patch I posted is the right way to solve the problem. $a['b'] is the 'correct' way to access an associative array outside of a quoted section, it should at least be allowed inside double quotes. This encourages consisitency within the language. ------------------------------------------------------------------------ [2003-02-13 12:52:17] philip@php.net Marking as critical. This is a serious bug as it's subtle and confuses newbies, especially when they/we try to use autoglobals in strings. This bug fix really needs to make it into 4.3.1 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21820 -- Edit this bug report at http://bugs.php.net/?id=21820&edit=1

« previous php.bugs (#38347) next »