Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56596 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72933 invoked from network); 24 Nov 2011 21:52:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Nov 2011 21:52:46 -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:41650] helo=mail-qy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/E7-26290-CACBECE4 for ; Thu, 24 Nov 2011 16:52:45 -0500 Received: by qyk33 with SMTP id 33so2444103qyk.29 for ; Thu, 24 Nov 2011 13:52:42 -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=Cas7h5/lzMWRHP2QbZCSawRM7Xtx0PJSVmQey1sMPIc=; b=Sp3Pem5W6YNzbfrj9M/tvf4Fvrh3c+7Y9rq2VHzSzTn8ycd56CyNGHV00vRG6RRCm7 M+f4LLxYbcHvjXW7keW/0rzH2xgv0rgpGosnRn8e22EQDahqLe/CW6YOlmzh5Dixh4P6 rVukRsO3u+a00/XhyTiVzgd1mdLKAvtwFg3nA= MIME-Version: 1.0 Received: by 10.229.67.5 with SMTP id p5mr3531523qci.148.1322171562516; Thu, 24 Nov 2011 13:52:42 -0800 (PST) Received: by 10.229.38.134 with HTTP; Thu, 24 Nov 2011 13:52:42 -0800 (PST) In-Reply-To: <4ECEBBB8.90604@lerdorf.com> References: <20111123015008.GA12933@panix.com> <4ECEBBB8.90604@lerdorf.com> Date: Thu, 24 Nov 2011 22:52:42 +0100 Message-ID: To: Rasmus Lerdorf Cc: Yasuo Ohgaki , RQuadling@gmail.com, Daniel Convissor , PHP Internals List Content-Type: multipart/alternative; boundary=0016e64bff5a50e28d04b2820e29 Subject: Re: [PHP-DEV] 5.4 regression: non-existent sub-sub keys now have values From: tyra3l@gmail.com (Ferenc Kovacs) --0016e64bff5a50e28d04b2820e29 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Nov 24, 2011 at 10:48 PM, Rasmus Lerdorf wrote= : > On 11/24/2011 01:44 PM, Yasuo Ohgaki wrote: > > Hi all, > > > > I should think twice before seding mail. "abc" as array index is > > converted to 0 since it's not a integer. So with current code is > > behave consistently with regards to string to long conversion. > > > > However, > > > > PHP 5.3 > > php -r '$s =3D "abc"; var_dump($s[0]["bar"]);' > > PHP Fatal error: Cannot use string offset as an array in Command line > > code on line 1 > > > > PHP 5.4 > > ./php -r '$s =3D "abc"; var_dump($s[0]["bar"]);' > > string(1) "a" > > > > Isn't it better to raise notice for accessing string by string index? > > There is no use to allowing string index access to strings. I think > > raising notice is feasible. Isn't it? > > String index access is still required since they are often numeric > strings. We could add a notice for non-numeric strings, but the check > would slow things down a bit. yeah, as I mentioned before: "The other improvement (related but not introduced in this change) that I suggested was that we could also trigger a notice when a "non-applicable" string offset is passed(defining non-applicable is a little bit hard, because of the current type-juggling rules, we have to allow $string["1"], because '1" can come from a database, or get/post, where it would be a string, not an int, but if we go with the current type juggling, $string["2_foo_3"] would also be converted to $string[2], which isn't really intended imo. ." I would vote for allowing only numbers in the string index/offset: [0-9]+ --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --0016e64bff5a50e28d04b2820e29--