Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56505 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18469 invoked from network); 23 Nov 2011 14:19:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2011 14:19:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.170 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.170 mail-qy0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:40926] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/03-31179-2010DCE4 for ; Wed, 23 Nov 2011 09:19:46 -0500 Received: by qyk33 with SMTP id 33so1306417qyk.29 for ; Wed, 23 Nov 2011 06:19:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yaoQul7O2T0x7AAJIaFdPWAm6/nw7NYsyZcJ1uPre5Y=; b=KJ101qgQGqegPr2FUfWosY1Hm1vLUxT+jg5sLjVJn7QLC5XdSmYLAzDcMNEgHA3PVO DWm6dvwF9HgBqLxq6+x/cNnXzv6nXzDuUiShqNs4V7M9h97W+Jg5nwBdtyC5x+buGqxe g6lUsARLGtz8Lg++7SdAyRCf6CgzV007M1qtc= MIME-Version: 1.0 Received: by 10.229.67.5 with SMTP id p5mr2736924qci.148.1322057983191; Wed, 23 Nov 2011 06:19:43 -0800 (PST) Received: by 10.229.38.134 with HTTP; Wed, 23 Nov 2011 06:19:42 -0800 (PST) In-Reply-To: <20111123141408.GA11940@panix.com> References: <20111123015008.GA12933@panix.com> <20111123023108.GA172@panix.com> <4ECCB549.904@lsces.co.uk> <4ECCBC56.3050602@sugarcrm.com> <20111123141408.GA11940@panix.com> Date: Wed, 23 Nov 2011 15:19:42 +0100 Message-ID: To: Daniel Convissor Cc: Stas Malyshev , Lester Caine , PHP internals Content-Type: multipart/alternative; boundary=0016e64bff5a75ec0704b2679c53 Subject: Re: [PHP-DEV] 5.4 regression: non-existent sub-sub keys now have values From: tyra3l@gmail.com (Ferenc Kovacs) --0016e64bff5a75ec0704b2679c53 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Nov 23, 2011 at 3:14 PM, Daniel Convissor < danielc@analysisandsolutions.com> wrote: > Hi Stas: > > > It's actually very simple. Take variable $a which is a string > > ("foo"). Now it you do $a[0] that would produce first letter - "f". > > Now here's a tricky part - if you do $a['blah'] it would convert > > 'blah' to number, get 0 and return the same letter "f". > > To me, this is the bug. $a['blah'] does not exist. An undefined index > notice should be raised. The key "blah" should not be converted to 0. > The following two things should behave the same: > > $b =3D array('exists' =3D> 'foo'); > echo $b['blah'] . "\n"; > > $a =3D 'foo'; > echo $a['blah'] . "\n"; > > But that second one echos out "f". This is a huge WTF. and the following should also behave the same: $a =3D 'foo'; echo $a[2]; echo $a['2']; echo $a['2 cats']; because this is how the type juggling works in php: http://php.net/manual/en/language.types.type-juggling.php if we allow strings to be used as indexes for strings, we have to be consistent with what we have already. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --0016e64bff5a75ec0704b2679c53--