mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fixed bug GH-20745 ("Casting out of range floats to int" applies to strings) (#20746)
This reverts the warning for float-strings, to whose it never should have been applied in the first place.
This commit is contained in:
2
NEWS
2
NEWS
@@ -10,6 +10,8 @@ PHP NEWS
|
||||
. Fixed bug GH-20714 (Uncatchable exception thrown in generator). (ilutov)
|
||||
. Fixed bug GH-20352 (UAF in php_output_handler_free via re-entrant
|
||||
ob_start() during error deactivation). (ndossche)
|
||||
. Fixed bug GH-20745 ("Casting out of range floats to int" applies to
|
||||
strings). (Bob)
|
||||
|
||||
- DOM:
|
||||
. Fixed bug GH-20722 (Null pointer dereference in DOM namespace node cloning
|
||||
|
||||
@@ -55,9 +55,8 @@ PHP 8.5 UPGRADE NOTES
|
||||
. Destructuring non-array values (other than NULL) using [] or list() now
|
||||
emits a warning.
|
||||
RFC: https://wiki.php.net/rfc/warnings-php-8-5#destructuring_non-array_values
|
||||
. A warning is now emitted when casting floats (or strings that look like
|
||||
floats) to int if they cannot be represented as one. This affects explicit
|
||||
int casts and implicit int casts.
|
||||
. A warning is now emitted when casting floats to int if they cannot be represented
|
||||
as one. This affects explicit int casts and implicit int casts.
|
||||
RFC: https://wiki.php.net/rfc/warnings-php-8-5#casting_out_of_range_floats_to_int
|
||||
. A warning is now emitted when casting NAN to other types.
|
||||
RFC: https://wiki.php.net/rfc/warnings-php-8-5#coercing_nan_to_other_types
|
||||
|
||||
@@ -40,10 +40,6 @@ Warning: The float NAN is not representable as an int, cast occurred in %s on li
|
||||
int(0)
|
||||
int(3)
|
||||
int(3)
|
||||
|
||||
Warning: The float-string "1.0E+121" is not representable as an int, cast occurred in %s on line %d
|
||||
int(9223372036854775807)
|
||||
|
||||
Warning: The float-string "1.0E+301" is not representable as an int, cast occurred in %s on line %d
|
||||
int(9223372036854775807)
|
||||
int(0)
|
||||
|
||||
@@ -40,10 +40,6 @@ Warning: The float NAN is not representable as an int, cast occurred in %s on li
|
||||
int(0)
|
||||
int(3)
|
||||
int(3)
|
||||
|
||||
Warning: The float-string "1.0E+121" is not representable as an int, cast occurred in %s on line %d
|
||||
int(2147483647)
|
||||
|
||||
Warning: The float-string "1.0E+301" is not representable as an int, cast occurred in %s on line %d
|
||||
int(2147483647)
|
||||
int(0)
|
||||
|
||||
@@ -14,6 +14,5 @@ var_dump($b | 1);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
The float-string "1.0E+4%d" is not representable as an int, cast occurred
|
||||
Implicit conversion from float-string "1.0E+4%d" to int loses precision
|
||||
int(%d)
|
||||
|
||||
@@ -25,8 +25,6 @@ var_dump($array[$string_float]);
|
||||
--EXPECTF--
|
||||
Warning: The float 1.0E+121 is not representable as an int, cast occurred in %s on line %d
|
||||
int(0)
|
||||
|
||||
Warning: The float-string "1.0E+121" is not representable as an int, cast occurred in %s on line %d
|
||||
bool(true)
|
||||
|
||||
Warning: The float 1.0E+121 is not representable as an int, cast occurred in %s on line %d
|
||||
|
||||
@@ -77,8 +77,6 @@ var_dump($string);
|
||||
--EXPECTF--
|
||||
Warning: The float 1.0E+121 is not representable as an int, cast occurred in %s on line %d
|
||||
int(0)
|
||||
|
||||
Warning: The float-string "1.0E+121" is not representable as an int, cast occurred in %s on line %d
|
||||
int(9223372036854775807)
|
||||
Attempt to read
|
||||
Float
|
||||
|
||||
@@ -77,8 +77,6 @@ var_dump($string);
|
||||
--EXPECTF--
|
||||
Warning: The float 1.0E+121 is not representable as an int, cast occurred in %s on line %d
|
||||
int(0)
|
||||
|
||||
Warning: The float-string "1.0E+121" is not representable as an int, cast occurred in %s on line %d
|
||||
int(2147483647)
|
||||
Attempt to read
|
||||
Float
|
||||
|
||||
@@ -149,10 +149,8 @@ static zend_always_inline zend_long zend_dval_to_lval_silent(double d)
|
||||
static zend_always_inline zend_long zend_dval_to_lval_cap(double d, const zend_string *s)
|
||||
{
|
||||
if (UNEXPECTED(!zend_finite(d))) {
|
||||
zend_oob_string_to_long_error(s);
|
||||
return 0;
|
||||
} else if (!ZEND_DOUBLE_FITS_LONG(d)) {
|
||||
zend_oob_string_to_long_error(s);
|
||||
return (d > 0 ? ZEND_LONG_MAX : ZEND_LONG_MIN);
|
||||
}
|
||||
return (zend_long)d;
|
||||
|
||||
@@ -274,7 +274,6 @@ int(1)
|
||||
string(7) "integer"
|
||||
-- Iteration 20 --
|
||||
string(6) "string"
|
||||
2: The float-string "2974394749328742328432" is not representable as an int, cast occurred
|
||||
bool(true)
|
||||
int(2147483647)
|
||||
string(7) "integer"
|
||||
@@ -305,7 +304,6 @@ int(1)
|
||||
string(7) "integer"
|
||||
-- Iteration 26 --
|
||||
string(6) "string"
|
||||
2: The float-string "2974394749328742328432" is not representable as an int, cast occurred
|
||||
bool(true)
|
||||
int(2147483647)
|
||||
string(7) "integer"
|
||||
@@ -675,7 +673,6 @@ int(1)
|
||||
string(7) "integer"
|
||||
-- Iteration 20 --
|
||||
string(6) "string"
|
||||
2: The float-string "2974394749328742328432" is not representable as an int, cast occurred
|
||||
bool(true)
|
||||
int(2147483647)
|
||||
string(7) "integer"
|
||||
@@ -706,7 +703,6 @@ int(1)
|
||||
string(7) "integer"
|
||||
-- Iteration 26 --
|
||||
string(6) "string"
|
||||
2: The float-string "2974394749328742328432" is not representable as an int, cast occurred
|
||||
bool(true)
|
||||
int(2147483647)
|
||||
string(7) "integer"
|
||||
|
||||
@@ -221,19 +221,11 @@ int(-2147483648)
|
||||
int(2147483647)
|
||||
|
||||
*** Testing intval() on non integer types ***
|
||||
|
||||
Warning: The float-string "-2147483649" is not representable as an int, cast occurred in %s on line %d
|
||||
int(-2147483648)
|
||||
|
||||
Warning: The float-string "2147483648" is not representable as an int, cast occurred in %s on line %d
|
||||
int(2147483647)
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
Warning: The float-string "020000000001" is not representable as an int, cast occurred in %s on line %d
|
||||
int(2147483647)
|
||||
|
||||
Warning: The float-string "-020000000001" is not representable as an int, cast occurred in %s on line %d
|
||||
int(-2147483648)
|
||||
int(0)
|
||||
int(0)
|
||||
|
||||
@@ -75,8 +75,6 @@ foreach ($values as $key => $value) {
|
||||
</body>
|
||||
</html>
|
||||
--- double overflow ---
|
||||
|
||||
Warning: The float-string "1.2089258196146E+24" is not representable as an int, cast occurred in %s on line %d
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
Reference in New Issue
Block a user