Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86540 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77245 invoked from network); 10 Jun 2015 08:30:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jun 2015 08:30:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.175 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.175 mail-wi0-f175.google.com Received: from [209.85.212.175] ([209.85.212.175:38204] helo=mail-wi0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/92-61871-095F7755 for ; Wed, 10 Jun 2015 04:30:10 -0400 Received: by wibdq8 with SMTP id dq8so39297279wib.1 for ; Wed, 10 Jun 2015 01:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wV71YSpKFWSQjwXWxH0xH9RSsPF/QzPDUaNEPCh+HwE=; b=zQLFCSpBod1p/do+dEVtf5lxz5/1R7BSUA8OPYWpTqR04TbFgOOGSmrKuDULLUb3Mn binbZgeTM2tcr+j/fLeiJ0nr2XbPsGvpwpDRcA1CO9bXa8q1XK4mWIkOIwFsMPK0v3ND A7WKQ0GqIGDnTh522gX3l4JdkFPaUxZ2Gqp4S7zPUx1pLVpFltNTpBea8yfADllNouj8 KWrWLobXlSUF2Ko+juVgZ1ORLxGoUEJ1TzhQz9/gnvi/WTLform0WIsi/asY6ei9a6gj 1+XmoMRUvjlxbfm3FOYXK5cGbrEjU0fL7ZWy2UMVI+txFLO2S/Z96xxnzf4e+z6p1FSB YrPA== MIME-Version: 1.0 X-Received: by 10.180.218.195 with SMTP id pi3mr6054113wic.71.1433925006185; Wed, 10 Jun 2015 01:30:06 -0700 (PDT) Received: by 10.27.179.96 with HTTP; Wed, 10 Jun 2015 01:30:06 -0700 (PDT) In-Reply-To: <5577DEE4.8030205@gmail.com> References: <5576051A.3040800@gmx.de> <55760771.6020802@gmail.com> <778F345F9918474AB8CAAB03082ECBF7@pc1> <5577DEE4.8030205@gmail.com> Date: Wed, 10 Jun 2015 10:30:06 +0200 Message-ID: To: Stanislav Malyshev Cc: Yasuo Ohgaki , Matt Wilmas , Christoph Becker , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1134ce04a0d967051825ae8a Subject: Re: [PHP-DEV] Array dereferencing of scalars From: nikita.ppv@gmail.com (Nikita Popov) --001a1134ce04a0d967051825ae8a Content-Type: text/plain; charset=UTF-8 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. Nikita --001a1134ce04a0d967051825ae8a--