On 20.02.2022 at 21:38, Craig Francis wrote: > On Sat, 1 Jan 2022 at 23:17, Craig Francis <cr...@craigfrancis.co.uk> wrote: > >> Draft RFC: >> https://wiki.php.net/rfc/allow_null >> > > > I've been over-complicating this... why should NULL be treated so > differently? > > <?php > $values = ['a', 1, 2.3, false, NULL]; > foreach ($values as $value) { > echo urlencode($value); > } > ?> > > It just struck me, this whole thing is about type coercion when not using > `strict_types=1`; and the 8.1 change has introduced an inconstancy by > deprecating the coercion of NULL, a frequently used value.
That "inconsistency" had been introduced with PHP 7.0.0, i.e. right when scalar type declarations have been introduced. Passing a null to a non-nullable parameter of a *userland* function throws a TypeError: <https://3v4l.org/lbF4h>. As of PHP 8.1.0, internal functions behave the same as userland function in this regard. -- Christoph M. Becker -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php