Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86578 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83731 invoked from network); 10 Jun 2015 22:38:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2015 22:38:34 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.21 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.21 mout.gmx.net Received: from [212.227.17.21] ([212.227.17.21:60109] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/E2-63696-96CB8755 for ; Wed, 10 Jun 2015 18:38:33 -0400 Received: from [192.168.0.100] ([95.89.139.132]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0MfEsY-1YfDCn02x8-00Opwi; Thu, 11 Jun 2015 00:38:23 +0200 Message-ID: <5578BC5F.2010305@gmx.de> Date: Thu, 11 Jun 2015 00:38:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Yasuo Ohgaki , Nikita Popov CC: Stanislav Malyshev , Matt Wilmas , 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 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:ZlTc6mQnMmWs28s0weVAUcqPiubkZ9St3axeLejBXewnoVWL/yJ bex2Ix66j0MofQMoFKJNv8Ehez94yJsGNpT1HjkG5Q09M3tXvgBHoAzWeiRpnoj88tjqE9W 7B2xJOSQoN27d+K247ghKW2KZObFSq65BO4b+bYbjwKp3IfaVnqAbjx7nZJMCu/LK37cYdM txS729E/gyecRbgh6N2YA== X-UI-Out-Filterresults: notjunk:1;V01:K0:t3ShEseLku8=:oFIJkiHXDmCmPmNM7PweFt TjbvWBJ51L9bfU+xZ5N/DERbfGOH5y2Qo5Q4pNdgQaoU7c9gIk2tcSQ6xcC6aZgJzERPPHHMO bsj18P+wjbQlhmptzy5VhVh/CivyGSZioBflEsSF+PHRKRKohyp5Se+gRkvn4ocnRTroRhvcW IXkIKYr+oiMfdVK0//Evor0JqNYa2hmLSGCOVB5K45wWT2MrxAXqKQNJe1BAH/tqlmeRGq0pB EAyxQEGm82HJTA7QplYMEcGy0TfoOG2d/HVHYkaRPDoi1EUXtZAR2VFzyi09eagng7aJenI2Q 4YsK6//5y2IHQQqJkwhmqJklObXfETtdVDkOFEQW3Ewe9Wcu/yZ5r/yGNmb7s9cgf/NVWm+ZJ up1TV2SHkC3nXEtFtFPq5BVTbyOU1o6fTnGuLleEOkzMUWkL03s/Zbj08qGEidQVpNWXkXSvP ic1FbiCQsnt9jEs6RV2KOysUVq4RiQFuOmrMzz/38ZsCLNx9O+4B67SK1kb7xBI/E55hkICeG Urd3kMtSY8z456klZlz//ROCDrdKuVZgN7CggoPphDlSzr4U2GVvH6ypHNRcU6I0Nf6bS+RTy YN81iyMG6oB56VQNsU0M6jMvR1Y6FYXXFOBc3RhGWr4FXPykI7eWGBEJX/6OX+n4pVmVRdgT0 E56kcCNqgcJTlUKmyJmE/ESFtNdcSAWKnwRM3Kn9Cxg8kAlLFHmNA4v76uxD24lqaFtg= Subject: Re: [PHP-DEV] Array dereferencing of scalars From: cmbecker69@gmx.de (Christoph Becker) Yasuo Ohgaki wrote: > On Wed, Jun 10, 2015 at 5:30 PM, Nikita Popov wrote: > >> On Wed, Jun 10, 2015 at 8:53 AM, Stanislav Malyshev >> wrote: >> >>>> >>> $foo = 42; >>>> $foo['bar']; // => NULL >>>> $v = NULL; >>>> $v[0][1][2][3][4][5][6][7][8][9]; // NULL >>>> >>>> this code is semantically wrong and I would like to have error/exception >>>> for such >>>> erroneous codes. It's inconsistent with array object, too. >>> >>> Why it's wrong? You try to get that's something not there, you get NULL. >>> I don't see anything wrong. Adding fatal error about every little thing >>> that isn't as expected never was how PHP worked. >> >> I agree with what other people have said here: We should keep the behavior >> for NULL, but drop the nonsense for other types - (42)[24] not throwing a >> notice is quite ridiculous, that seems like a pretty obvious bug to me. > > I agree that NULL is debatable. In PHP, NULL is treated as 0/false by its > context. > It's simpler if we get rid of the behavior altogether. IMO. > > Anyway, removing undefined behavior from other types may be good enough so > I don't insist. +1 -- Christoph M. Becker