Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86632 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76693 invoked from network); 14 Jun 2015 03:35:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jun 2015 03:35:47 -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.160.172 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.172 mail-yk0-f172.google.com Received: from [209.85.160.172] ([209.85.160.172:34599] helo=mail-yk0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/75-07883-396FC755 for ; Sat, 13 Jun 2015 23:35:47 -0400 Received: by ykfl8 with SMTP id l8so35482879ykf.1 for ; Sat, 13 Jun 2015 20:35:45 -0700 (PDT) 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=FrU4PCh3l5NINPSYg6+1vRoGhBv4NlHopNIRPYLkWkA=; b=J9LVYjGAd8rElf3aKQF1iVnHN9+ov7F7h6SunALlrL7qq5/qKPe3Fm55ZWmqSB4jSz thIazwhDUvONB67UbnqobP671btjrvAfknfQMUHQ/X+Y5F9PPVgZLZLQ+rRmzIniLn45 0TpbuGx4HOavBd/2FXeheDD6Ir8v5kZVC9k4mDjqyV9KSp4TK1RpofjcCstyq89jAyrK OYGUkp/5sYZmvt/IuyjMkWOAA7bswzRFVpBbMyVDnVcirNMqHwIFXKZP1R3lnNjBtoah bAc7vJWA95rQj5VMFFQ0JkHOFdgy3SFwJN+Rfy8IVgfZL712pSygmQdiSB//rIjZQWJk 05EA== X-Received: by 10.170.118.86 with SMTP id k83mr5782ykb.64.1434252945192; Sat, 13 Jun 2015 20:35:45 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.13.246.2 with HTTP; Sat, 13 Jun 2015 20:35:04 -0700 (PDT) In-Reply-To: References: <5576051A.3040800@gmx.de> <55760771.6020802@gmail.com> <778F345F9918474AB8CAAB03082ECBF7@pc1> <5577DEE4.8030205@gmail.com> <55794DE2.2080602@gmail.com> <557A1B52.1050501@gmail.com> Date: Sun, 14 Jun 2015 12:35:04 +0900 X-Google-Sender-Auth: kBEC5FLqQ8NNtmMEVx96379_Qoo Message-ID: To: Chris Wright Cc: Rowan Collins , PHP Internals List Content-Type: multipart/alternative; boundary=001a1137ccec50fbf805187209c3 Subject: Re: [PHP-DEV] Array dereferencing of scalars From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1137ccec50fbf805187209c3 Content-Type: text/plain; charset=UTF-8 Hi all, On Fri, Jun 12, 2015 at 9:36 AM, Chris Wright wrote: > On 12 June 2015 at 00:35, Rowan Collins wrote: > > > On 11/06/2015 21:22, Chris Wright wrote: > > > >> I'm inclined to agree that we should have consistency here, and that the > >> current behaviour in a function context is the correct one. A couple of > >> (IMO) good arguments for this: > >> > >> - The function behaviour gives a more explanatory and useful error > message > >> - This is definitely a programming error, there is no valid reason to > use > >> NULL as a variable name in this manner. It amounts to what many/most > other > >> languages would consider to be a "null pointer exception" or equivalent, > >> and the more useful error message may help track down the error quicker > >> (one might look for a case where the empty string was assigned, instead > of > >> looking for a case where it may be NULL). > >> > > > > Well, if you were to model it precisely on the function case, the > > *consistent* behaviour would be to error on any non-string value (e.g. > $v = > > 42; $$v;) but not a string which is an illegal variable name ($v = '42'; > > $v(); just complains that function 42 doesn't exist, not that it never > > could). > > > > A more useful approach would perhaps be to look at what should be a valid > > function name, and what should be a valid variable name, and throw an > error > > if dynamic access is used to by-pass either restriction. > > > > +1 > > If anything is to be done, then this should be it - properly abstract the > underlying structures so that the lexical/conventional limitations on > symbol naming are also imposed by mechanisms that let userland directly > manipulate the names of symbols (define(), class_alias() etc). +1 It sounds good change to spot possible bugs. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1137ccec50fbf805187209c3--