[RFC] Consistent null behaviour
| From: | ilija dot tovilo at me dot com | Date: | Wed, 20 Sep 2017 17:06:33 +0000 |
| Subject: | [RFC] Consistent null behaviour | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-100719@lists.php.net to get a copy of this message | ||
Hi everybody!
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.
Any thoughts?
Regards,
Ilija