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
This is caused by an erroneous assumption in gmp_cast_object() for _IS_NUMBER casts (as such it can affect other functions as well), namely that ZEND_LONG would be a signed long, but that is not true for LLP64 data models where it is signed long long. On such platforms, values outside of range [INT_MIN, INT_MAX] are converted to float.
PHP Version
PHP-8.2
Operating System
Windows 64bit
The text was updated successfully, but these errors were encountered:
Oops. In the meantime I've noticed that array_sum() in PHP-8.2 is not affected by this (since objects are skipped); so the given reproducer does not apply. Still, the issue should be fixed in PHP-8.2, too, since it may affect external extensions. I don't think the bug could be triggered using SimpleXML, which is the only other extension using convert_scalar_to_number() in php-src.
cmb69
added a commit
to cmb69/php-src
that referenced
this issue
Nov 21, 2024
Description
The following code:
Resulted in this output:
But I expected this output instead:
This is caused by an erroneous assumption in
gmp_cast_object()
for_IS_NUMBER
casts (as such it can affect other functions as well), namely thatZEND_LONG
would be asigned long
, but that is not true for LLP64 data models where it issigned long long
. On such platforms, values outside of range[INT_MIN, INT_MAX
] are converted to float.PHP Version
PHP-8.2
Operating System
Windows 64bit
The text was updated successfully, but these errors were encountered: