You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Casting out of range floats to int" applies to strings #20745
PHP Warning: The float-string "9999999999999999999" is not representable as an int, cast occurred in Command line code on line 1
int(9223372036854775807)
But I expected this output instead:
int(9223372036854775807)
I just updated to PHP 8.5.0 and surprisingly started seeing these warnings.
Now, e.g. (int) "a" is fine emitting 0 as expected ... but once that string is something looking like a number, it suddenly emits a warning.
This is especially problematic when accepting arbitrary user input like (int) ($_POST['value'] ?? 0).
I strongly object to this behaviour on strings - on floats, it's fine (and was voted on).
Activity
bwoebi commentedon Dec 21, 2025
Opened #20746 with a fix.
Fixed bug phpGH-20745 ("Casting out of range floats to int" applies t…
Fixed bug GH-20745 ("Casting out of range floats to int" applies to s…
ndossche commentedon Dec 29, 2025
Manually closing as this is merged now.