Open
Description
Description
The following code:
<?php
if ( (string) PHP_INT_MAX === '9223372036854775808' ) {
echo "string identical" . PHP_EOL;
}
if ( PHP_INT_MAX === (int) '9223372036854775808' ) {
echo "int identical" . PHP_EOL;
}
Resulted in this output:
int identical
But I expected this output instead:
Deprecated: Conversion from string '9223372036854775808' to int loses precision
A very similar error already exists when converting float to int implicitly e.g. $a[ PHP_INT_MAX + 1 ] = '';
See also #17081 which reports that for float/int casts
PHP Version
PHP 8.4.8
Operating System
No response