Re: Allowing NULL for some internal functions

From: Date: Mon, 28 Feb 2022 16:40:51 +0000
Subject: Re: Allowing NULL for some internal functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-117163@lists.php.net to get a copy of this message
On 21-02-2022 10:04, Christoph M. Becker wrote:
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.
In my view, consistency between internal and userland functions brings a lot of value, and not only for the language itself. As soon as internal and userland become fully consistent it will become a lot easier to write "internal" functions in PHP rather than C. Not only will that make developing the standard library easier, it may also make the optimizer and JIT compiler more effective. The more consistency the better. Approaches 2 and 3 from the RFC are a step in the right direction. Regards, Dik Takken

« previous php.internals (#117163) next »