Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86591 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30481 invoked from network); 11 Jun 2015 09:01:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jun 2015 09:01:10 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.180 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:38878] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/B9-63696-45E49755 for ; Thu, 11 Jun 2015 05:01:08 -0400 Received: by wibdq8 with SMTP id dq8so3606792wib.1 for ; Thu, 11 Jun 2015 02:01:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=gQTzD+ziDvaPsXRMO/eCiXyzGMyi7Uo4jiAJqwEIc0E=; b=S/jd5k1zimJg0BwY9iDRZk/RuTL4FjXEG+io9IMHLDyJ1t7XGY/nx2K+byXboy8bDN QsRjxz96WPTe6Jerl6F9SW1R9bzzQ4Loa1VyYmNhsaW7V+xQhssqC03V6/Kw9lzsqFUL b5S1qWX/7cgAY2b4+HfGCdHKFNhOQSiYUIqcxUtLurMceB3eJMrwS0rLdjgwKPSykTlJ TUs1GC6wJixLRObWLv32ZEM/tVxEX65eElFt110EAptQcIzSP7Nb8SFAgM9NMB/3efB0 RyQrBvWqpN6QINlDTYkRkl088HCsqxD/hN4bczUJaYP6B5Bx2xJ/AQKL5K8AnwFrIgJZ oLwg== X-Received: by 10.194.179.10 with SMTP id dc10mr14365223wjc.63.1434013263768; Thu, 11 Jun 2015 02:01:03 -0700 (PDT) Received: from [192.168.0.159] ([62.189.198.114]) by mx.google.com with ESMTPSA id pg1sm42954wjb.39.2015.06.11.02.01.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 02:01:02 -0700 (PDT) Message-ID: <55794DE2.2080602@gmail.com> Date: Thu, 11 Jun 2015 09:59:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: internals@lists.php.net References: <5576051A.3040800@gmx.de> <55760771.6020802@gmail.com> <778F345F9918474AB8CAAB03082ECBF7@pc1> <5577DEE4.8030205@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Array dereferencing of scalars From: rowan.collins@gmail.com (Rowan Collins) Yasuo Ohgaki wrote on 11/06/2015 00:50: > If PHP should return NULL always against NULL variables, we may be better > to > reconsider these behavior. > > [yohgaki@dev Download]$ php > $v = NULL; > $$v; > > > PHP Notice: Undefined variable: in - on line 3 This is not complaining that $v is NULL, it is warning you the same as if you wrote $v = 'some_name_you_never_assigned_to'; $$v; Somewhat surprisingly, you can actually assign to the variable whose name is NULL: http://3v4l.org/5pXJg > [yohgaki@dev Download]$ php > $v = NULL; > $v(); > > PHP Fatal error: Uncaught EngineException: Function name must be a string > in -:3 > Stack trace: > #0 {main} > thrown in - on line 3 This one has given a different message because of it being a non-string value, but would be equally fatal if you tried to call any undefined function. Would coercing NULL to an imaginary function which returns NULL actually be useful for anything? > I don't care much whether these yield NULL always or raise error/exception, > but there should be consistency. I see no reason why these cases need to be consistent, just because they both involve NULLs. It's all about the action you invoke, not just the value something's interpreted as. -- Rowan Collins [IMSoP]