Re: NULL Coercion Consistency
| From: | Craig Francis | Date: | Fri, 08 Apr 2022 18:07:37 +0000 |
| Subject: | Re: NULL Coercion Consistency | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117503@lists.php.net to get a copy of this message | ||
On Fri, 8 Apr 2022 at 18:54, Mel Dafert <mel@dafert.at> wrote:
> In particular, does this propose changing user-defined functions under
> strict_types=0 to accept null for scalar types?
>
> Eg., this will be allowed (under strict_types=0):
> ```
> function x(string $y, int $z) {
> ...
> }
> x(null, null); //no error, no warning
> ```
>
tbh my focus has been on the problems that have come up with internal
functions.
With user defined functions, I think it's up for debate (still a draft),
but I think those NULL's should be coerced to the specified type (as
documented), where I don't think PHP should be doing type checking under
strict_types=0.
Craig