Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56523 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71056 invoked from network); 23 Nov 2011 18:52:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2011 18:52:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.123 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.123 smtp123.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.123] ([67.192.241.123:50806] helo=smtp123.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/B3-47904-7E04DCE4 for ; Wed, 23 Nov 2011 13:52:24 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp12.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id D125A3C0199; Wed, 23 Nov 2011 13:52:20 -0500 (EST) X-Virus-Scanned: OK Received: by smtp12.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 750763C00B7; Wed, 23 Nov 2011 13:52:20 -0500 (EST) Message-ID: <4ECD40E2.1000601@sugarcrm.com> Date: Wed, 23 Nov 2011 10:52:18 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Daniel Convissor CC: Lester Caine , PHP internals References: <20111123015008.GA12933@panix.com> <20111123023108.GA172@panix.com> <4ECCB549.904@lsces.co.uk> <4ECCBC56.3050602@sugarcrm.com> <20111123141408.GA11940@panix.com> In-Reply-To: <20111123141408.GA11940@panix.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] 5.4 regression: non-existent sub-sub keys now have values From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! On 11/23/11 6:14 AM, Daniel Convissor wrote: > To me, this is the bug. $a['blah'] does not exist. An undefined index If it's a bug, this bug was in PHP since forever, nothing new here. > notice should be raised. The key "blah" should not be converted to 0. > The following two things should behave the same: > > $b = array('exists' => 'foo'); > echo $b['blah'] . "\n"; > > $a = 'foo'; > echo $a['blah'] . "\n"; No they should not. First is array access, second is string offset access, totally different ops. That's like saying + on arrays should calculate the sum of all array elements because + on numbers calculates the sum. Operators have different meanings for different types, it has always been so in all languages. One could argue that string access with non-string should produce a notice, but probably if we added that a lot of people would come out to complain we broke their perfectly working code ;) -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227