Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86576 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79708 invoked from network); 10 Jun 2015 22:23:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2015 22:23:10 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.196 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.196 mail-yk0-f196.google.com Received: from [209.85.160.196] ([209.85.160.196:35585] helo=mail-yk0-f196.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/22-63696-DC8B8755 for ; Wed, 10 Jun 2015 18:23:10 -0400 Received: by ykp131 with SMTP id 131so4871715ykp.2 for ; Wed, 10 Jun 2015 15:23:06 -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=ud9F9c/uag58ht7fss/pQHkPxfw/WUePiOeqd0UmzI8=; b=QY4L1GzJnkiA8qhncfMc4OdQTl4gQZ/hljOZ7VFCkpDz/yn2VLE7rrBToL9BCAlT91 Qg5xoOmNR6k8smumL5tfjbHVBUymxVZUHohlLgsS5nA5mnJLns6ftkIVY3J0D9jfqzOR 3911M5kvHt4VMwyr5XQrTkYyPNsMJ8CSGupJOXe9feQ2qButtB/aVDOCoSNB+EcDTQRe iGe1bPeWvI3XIOERhLsRvRKRSwZVfLSYLfSNHylr64sk6ry6dR+XvYaoeSWGiCbRi6VG Nbjb7a/2QGJU07H8LO6OC87hKA46iuziUJgB60X5MLn7yhkFfSh84ogzty9xjDohjJDX xxEw== X-Received: by 10.170.215.69 with SMTP id h66mr7317060ykf.74.1433974986798; Wed, 10 Jun 2015 15:23:06 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.13.246.2 with HTTP; Wed, 10 Jun 2015 15:22:26 -0700 (PDT) In-Reply-To: References: <5576051A.3040800@gmx.de> <55760771.6020802@gmail.com> <778F345F9918474AB8CAAB03082ECBF7@pc1> <5577DEE4.8030205@gmail.com> Date: Thu, 11 Jun 2015 07:22:26 +0900 X-Google-Sender-Auth: sT0oYN5NNIV_KmrT2sr5VZvqVik Message-ID: To: Nikita Popov Cc: Stanislav Malyshev , Matt Wilmas , Christoph Becker , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a113bcfa0b47c30051831512f Subject: Re: [PHP-DEV] Array dereferencing of scalars From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a113bcfa0b47c30051831512f Content-Type: text/plain; charset=UTF-8 Hi Stas and Nikita, On Wed, Jun 10, 2015 at 5:30 PM, Nikita Popov wrote: > On Wed, Jun 10, 2015 at 8:53 AM, Stanislav Malyshev > wrote: > >> Hi! >> >> > > > $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. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a113bcfa0b47c30051831512f--