Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81395 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46271 invoked from network); 30 Jan 2015 00:57:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2015 00:57:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.45 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.45 mail-qa0-f45.google.com Received: from [209.85.216.45] ([209.85.216.45:55242] helo=mail-qa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/A1-38077-0F6DAC45 for ; Thu, 29 Jan 2015 19:57:20 -0500 Received: by mail-qa0-f45.google.com with SMTP id n8so17896976qaq.4 for ; Thu, 29 Jan 2015 16:57:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=pKB6eaWj24U/mBO/mErKxrRCz69C5Tm8T6QvfHf2RYA=; b=NcqJvXuffh1aunscoITa/HlCPi8gj6XesfAREsoRDJUtEnjXqoGrmjZh+R3UB0xx3l mpuuW2SEWAZtMbccv+Y8hHySV2xI85DOYBck6HL5LAtTYfc09Y/lPoe5+y0JKqvJSxaU 8/+ZatSQhdu3YmM/sCjfcMhFT3MIL0002Ck6bqfB0wKzicOMCjzaoTnq/KwHAar01G00 q7CG5dJ+tSikW+z0QasCUVZ5m74ly0W5lTx9XQ0f/x1yCDb4HZQivV1k5ruMCehU9nA4 eJqDQeFxtAn4MMi7u5sxCFU9BORC02D6+lLba/i+aBM2RnBEvtlE/103f+xj4eZyH3+4 dQ2w== X-Received: by 10.224.111.194 with SMTP id t2mr7056168qap.86.1422579437729; Thu, 29 Jan 2015 16:57:17 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.93.70 with HTTP; Thu, 29 Jan 2015 16:56:36 -0800 (PST) In-Reply-To: <54CAC771.3050800@lerdorf.com> References: <54CAC771.3050800@lerdorf.com> Date: Fri, 30 Jan 2015 09:56:36 +0900 X-Google-Sender-Auth: 07UDpQdR-0_cug_5LNlie6Qkwig Message-ID: To: Rasmus Lerdorf Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=047d7b6045820cfe98050dd41693 Subject: Re: [PHP-DEV] Use of {} with member. From: yohgaki@ohgaki.net (Yasuo Ohgaki) --047d7b6045820cfe98050dd41693 Content-Type: text/plain; charset=UTF-8 Hi all, On Fri, Jan 30, 2015 at 8:51 AM, Rasmus Lerdorf wrote: > On 01/29/2015 01:32 PM, Yasuo Ohgaki wrote: > > Hi all, > > > > I came across with bug #68947 https://bugs.php.net/bug.php?id=68947 > > and realized small inconsistency. > > > > http://3v4l.org/ldZKl > > > > $obj->${array[$key]}; // Syntax error > > $obj->{$array[$key]}; // Works > > > > $obj->${key}; // E_NOTICE. Does not work > > $obj->{$key}; // Works > > > > echo "${array[$key]}"; // Works > > echo "{$array[$key]}"; // Works > > > > Of course, script/string parsing aren't the same. Are there technical > > reasons > > why ${value} is not allowed? If there are, we may encourage > > > > echo "{$array[$key]}"; // Works > > > > rather than > > > > echo "${array[$key]}"; // Works > > That all seems expected to me. The original point of that bug report is > the BC break due to the uniform variable rfc. The change makes sense, > but just for the record, I have installed about 10 popular, and a couple > of not-so-popular, PHP apps and tested them on PHP 7 over the past week > and this was the only BC break that affected that set of 10 apps. > > See: > > https://github.com/rlerdorf/avalon/commit/18847d0fe65381977397271c79e04dde72ef86f8 > > It is listed as a bullet point in a sea of other bullet points in the > UPGRADING file: > > . Indirect variable, property and method references are now > interpreted with left-to-right semantics. See details in: > > > https://wiki.php.net/rfc/uniform_variable_syntax#semantic_differences_in_existing_syntax > > > But we probably need a section devoted to BC breaks that includes some > real-world code examples. I agree. Since ${var} works in quoted string just like shells, there may be confusion. Extending http://php.net/manual/en/language.variables.basics.php or adding new section might be good. I haven't checked variable variable fully. There may be misbehavior http://3v4l.org/vmKvi Apparently, HHVM have missed to support multiple variable variable reference. Heads up HHVM folks! Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --047d7b6045820cfe98050dd41693--