1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix curl_multi_exec() overflow message (GH-17078)

As is, passing `2147484` as `$timeout`, throws a `ValueError` stating
the `$timeout` needs to be between 0 and 2147484, what is a confusing.
Thus we report the proper threshold as float.

While we're at it we also drop the superfluous `(double)` cast, and
rely on C's usual arithmetic conversions.
This commit is contained in:
Christoph M. Becker
2024-12-13 16:06:39 +01:00
committed by GitHub
parent a7cf0725d8
commit bb6dbdcf94
2 changed files with 4 additions and 4 deletions

View File

@@ -214,8 +214,8 @@ PHP_FUNCTION(curl_multi_select)
mh = Z_CURL_MULTI_P(z_mh);
if (!(timeout >= 0.0 && timeout <= ((double)INT_MAX / 1000.0))) {
zend_argument_value_error(2, "must be between 0 and %d", (int)ceilf((double)INT_MAX / 1000));
if (!(timeout >= 0.0 && timeout <= (INT_MAX / 1000.0))) {
zend_argument_value_error(2, "must be between 0 and %f", INT_MAX / 1000.0);
RETURN_THROWS();
}

View File

@@ -24,6 +24,6 @@ $mh = curl_multi_init();
var_dump(curl_multi_select($mh, 1000000));
?>
--EXPECTF--
curl_multi_select(): Argument #2 ($timeout) must be between %d and %d
curl_multi_select(): Argument #2 ($timeout) must be between %d and %d
curl_multi_select(): Argument #2 ($timeout) must be between %d and %f
curl_multi_select(): Argument #2 ($timeout) must be between %d and %f
int(0)