Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86520 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89765 invoked from network); 9 Jun 2015 12:45:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Jun 2015 12:45:19 -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.181 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.181 mail-wi0-f181.google.com Received: from [209.85.212.181] ([209.85.212.181:35861] helo=mail-wi0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/E3-00828-EDFD6755 for ; Tue, 09 Jun 2015 08:45:19 -0400 Received: by wigg3 with SMTP id g3so15793882wig.1 for ; Tue, 09 Jun 2015 05:45:15 -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=XA/twPrzNMy2N6oj7Zt1AwEojEqDbOH9iHJ3PvNaOWc=; b=rASQKXhg0KR5eRTvBjkEpaV3BJ5TUDzRZceJwh8afmHz+vCBfFWuy/y95fgYHD01+6 yjrYbX/WgsjSuF6St1Y1+pmkaaIcsxaQtm6uYrb6dA5kaicO3nSad13gTXDi25FTaia3 lh+0ydeIqjUe2D8zCCuvpSnm4o8+mo5BKwpYmkz8gjcX1bwhZsD5YbB/rAM7yqZY7/HH q9ZcN/e3H0rU3D6Qs4lCY0d7use9hUJOlYnwTsvPGxiihzjefehbMLwsLF18tYDHmc4x Ax6t4McObiJ4hlgBrTz4ZGQs/XFKlMWdfNecknKqoCOLOX2o6WHrp88d9sPLSy0i1PMY NeaQ== X-Received: by 10.180.88.72 with SMTP id be8mr32301441wib.42.1433853915811; Tue, 09 Jun 2015 05:45:15 -0700 (PDT) Received: from [192.168.0.159] ([62.189.198.114]) by mx.google.com with ESMTPSA id l6sm9258959wjz.4.2015.06.09.05.45.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jun 2015 05:45:15 -0700 (PDT) Message-ID: <5576DF78.8060409@gmail.com> Date: Tue, 09 Jun 2015 13:43:36 +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> <5576CC2E.8080908@gmx.de> <5576DD88.9090304@gmx.de> In-Reply-To: <5576DD88.9090304@gmx.de> 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) Christoph Becker wrote on 09/06/2015 13:35: > Current behavior: > > $v = NULL; > echo $v->foo->bar; > ?> > Notice: Trying to get property of non-object in %s on line %d > Notice: Trying to get property of non-object in %s on line %d > > So trying to access a property on NULL gives a notice, but trying to > access an element of NULL shouldn't? Also note, that chained property > access raises multiple notices. Again, assignment works differently here: $v = NULL; $v->foo->bar = 42; // Warning: Creating default object from empty value Interestingly, only one Warning is issued for this case, even though the inner value must also be created. This seems like a more useful behaviour, because it doesn't clutter the log/output with repeated notices about a single line. Regards, -- Rowan Collins [IMSoP]