> Le 14 juil. 2025 à 18:23, Gina P. Banyard <intern...@gpb.moe> a écrit :
> Hello internals,
>
> Similar to the mass deprecation RFC, I would like to propose the addition of
> a few warnings in certain situations:
> https://wiki.php.net/rfc/warnings-php-8-5
>
> I am expecting these 4 sub-proposals to be mostly uncontroversial,
> other than possibly, the "Using offsets on non-container values in
> isset()/empty()" one.
>
> As this is intended to land in PHP 8.5 the discussion will last 2 weeks and
> voting will commence on Monday the 28th of July 2025.
>
> Best regards,
>
> Gina P. Banyard
Hi,
About “ coercing NAN to other types”:
* The result of `(string) NAN` seems reasonable to me and don’t need warning.
* I agree that `(int) NAN` does not make much sense, but if we warn on that, we
should also warn on `(int) INF`, which makes even less sense (I expected `(int)
INF` to yield `PHP_INT_MAX`, but it yields `0`).
* I strongly think that this should be a deprecation, not a warning. There may
be correct programs that rely on the fact that explicit coercing from a random
scalar to another scalar type is infallible (as it is the case today), although
not expecting a specific value from a buggy input (GIGO principle).
—Claude