Re: NULL Coercion Consistency
| From: | Craig Francis | Date: | Sat, 07 May 2022 08:38:51 +0000 |
| Subject: | Re: NULL Coercion Consistency | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117682@lists.php.net to get a copy of this message | ||
On 7 May 2022, at 04:45, Jordan LeDoux <jordan.ledoux@gmail.com> wrote:
>
> On Fri, Apr 8, 2022 at 10:35 AM Craig Francis <craig@craigfrancis.co.uk
> <mailto:craig@craigfrancis.co.uk>> wrote:
> https://wiki.php.net/rfc/null_coercion_consistency
> <https://wiki.php.net/rfc/null_coercion_consistency>
>
>
> This RFC seems to be trying to force all PHP developers, regardless of what *they* think, to
> treat null as "whatever the default value is within the type context of execution", which
> is probably the most dangerous and bug-prone usage of null in PHP code. This would make it almost
> impossible for most programs to treat null instead as "an undefined value which must be
> explicitly set", which is another usage I commonly see in code.
Not what I'm going for... but anyway, to get an idea of your position, do you think the string
'15' should be coerced to a number, or should it fatal error as well? e.g.
$my_number = round($request->get('my_number'));
Craig