Re: [RFC] Consistent null behaviour

From: Date: Wed, 20 Sep 2017 21:13:52 +0000
Subject: Re: [RFC] Consistent null behaviour
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-100727@lists.php.net to get a copy of this message
On 20.09.2017 at 19:06, ilija.tovilo@me.com wrote: > To my surprise, I noticed today that an array access on a null > value returns null without any warning whatsoever. > Accessing the property of a null value gives you a notice, > while calling a function on that null value gives you a fatal error. > > https://3v4l.org/ZSZHN > > This is pretty inconsistent. IMO all of these should be fatal errors, although I realize that > might be a bit drastic for PHP 8. > We should at least give the user a notice when using array access on a > null value. There is already a respective RFC[1] which has been accepted for PHP 7.2, but there are issues[2]. [1] <https://wiki.php.net/rfc/notice-for-non-valid-array-container> [2] <http://news.php.net/php.internals/97520> -- Christoph M. Becker

« previous php.internals (#100727) next »