Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92228 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16439 invoked from network); 12 Apr 2016 14:03:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2016 14:03:26 -0000 Authentication-Results: pb1.pair.com header.from=kalle.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kalle.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.65 as permitted sender) X-PHP-List-Original-Sender: kalle.php@gmail.com X-Host-Fingerprint: 74.125.82.65 mail-wm0-f65.google.com Received: from [74.125.82.65] ([74.125.82.65:32771] helo=mail-wm0-f65.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/80-13103-B200D075 for ; Tue, 12 Apr 2016 10:03:24 -0400 Received: by mail-wm0-f65.google.com with SMTP id y144so5666927wmd.0 for ; Tue, 12 Apr 2016 07:03:23 -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:date:message-id:subject :from:to:cc; bh=kCrH/a5b7YfDYalPSBEHejpljvXtRZr++FGVAQ0jEUk=; b=xwPhP4eiQltAhp5S/wPE2iabzD//VIPaUYnGSFx6mZW3zJoPCfa6wD7NdvZIP0WtCo 6UCQ8soxWAfhM15fHy9Db9vRYLiavkikljnuKR/TMaM7gc+ipexTinoFUtctBGPuEG4J /+XSl1fs/tvWzx5ejBjgYgY7YLRvpg8uxF/ic+2OUxhZZnDedLREIBnx/1b3ru9+MBTN YhXVjCJG16qNeMM22HkTORf5s+az5Em9gTjlqLfu2X8z2on/Y6YIKub1TMcpZ2l3QQOt 7VwO6UQGtOeaDjlogAKv0YueFcUaaCzP4DCZvpp8Xc3PQjGUtDwePXb0jsO7itj+lTig JHqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=kCrH/a5b7YfDYalPSBEHejpljvXtRZr++FGVAQ0jEUk=; b=m3qXsd7TpwvIhXnTV7c9iTIa2INl31Wbt6XAL8O3LLHR15BUX/LZMZKGNDDj3Jmut+ bEA/cMM38YjNA274squbqVsL1jectbKv3SVEih6tokrnDdLVBN00vQLr68EMiAY34e9t +D/6cuVnksfckq0LXvL1J2zHEV4+OJ6ihs/g+wGDeDMeTxTIfenu0GkHzENfHDQK0yc1 8bM0EFma6UJS83D+9Jp0zxjuRHTnlM3Cjlo/wbtOYEOKTojioc2I9gNOUC0cfAzGIJRS FAwA1TxpWvDZHNSWQlDXNJgsoT/ODPfHpVmJBL60hhff0eCEpzRJAFde1HfLUWxjpeYJ BKgA== X-Gm-Message-State: AOPr4FUF3H3wYSSPkAjUJow39DmSwVgOLgL1BHqy8V8M50o/dp22aqc5cUJN8LBkdHcyyhmS2TVaCVPE8IqaGw== MIME-Version: 1.0 X-Received: by 10.194.3.105 with SMTP id b9mr4243480wjb.140.1460469800174; Tue, 12 Apr 2016 07:03:20 -0700 (PDT) Sender: kalle.php@gmail.com Received: by 10.28.130.73 with HTTP; Tue, 12 Apr 2016 07:03:19 -0700 (PDT) Received: by 10.28.130.73 with HTTP; Tue, 12 Apr 2016 07:03:19 -0700 (PDT) In-Reply-To: References: <570CF1B3.3070303@hoa-project.net> Date: Tue, 12 Apr 2016 16:03:19 +0200 X-Google-Sender-Auth: j-EqPBuQ5GT1KqyPk2XrFRQOYVo Message-ID: To: "Ivan Enderlin@Hoa" Cc: Internals Content-Type: multipart/alternative; boundary=047d7b3a8412a509c805304a1f15 Subject: Re: [PHP-DEV] Array key access on non-array values - to be made illegal? From: kalle@php.net (Kalle Sommer Nielsen) --047d7b3a8412a509c805304a1f15 Content-Type: text/plain; charset=UTF-8 On Apr 12, 2016 15:02, "Ivan Enderlin" wrote: > > Hello Marco, > > Actually, you are trying to access to something that does not exist, so you get a null value. This part is logical. However, yes, a notice would be welcomed except it may be skipped for historical reasons I reckon. Probably to work well with `isset` or similar scenario. Isset works regardless, because it is implemented as a language construct. But on topic, then yes, it should emit a notice. > > Cheers. > > > On 12/04/16 14:59, Marco Pivetta wrote: >> >> Hello, >> >> I just stumbled upon behavior that seems to "fail silently" regardless of >> its very questionable validity: >> >> > >> $a = 1; >> >> var_dump($a[123]); // NULL, no notice >> >> https://3v4l.org/b3rDr >> >> Are there specific reasons why no notice is thrown? Is it by design? If so, >> does anyone remember why? >> >> I haven't checked if this affects other types too. I know that an >> assignment to an array key of a non-array would cause a cast of the value >> to `array`, but a mere read operation should surely cause a notice to be >> raised in the above scenario. >> >> Cheers, >> >> Marco Pivetta >> >> http://twitter.com/Ocramius >> >> http://ocramius.github.com/ >> > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --047d7b3a8412a509c805304a1f15--