mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Follow-up on GH-15548: curl_multi_select.
throws a ValueError on timeout overflow. close GH-15594
This commit is contained in:
@@ -574,6 +574,10 @@ PHP 8.4 UPGRADE NOTES
|
||||
. trigger_error() and user_error() now have a return type of true instead of
|
||||
bool.
|
||||
|
||||
- Curl:
|
||||
. curl_multi_select throws a ValueError if the timeout argument if it's negative
|
||||
or greater than PHP_INT_MAX.
|
||||
|
||||
- DOM:
|
||||
. DOMDocument::registerNodeClass() now has a tentative return type of true.
|
||||
Previously, the return type was bool but only true could be returned in practice.
|
||||
|
||||
@@ -188,11 +188,8 @@ PHP_FUNCTION(curl_multi_select)
|
||||
mh = Z_CURL_MULTI_P(z_mh);
|
||||
|
||||
if (!(timeout >= 0.0 && timeout <= ((double)INT_MAX / 1000.0))) {
|
||||
php_error_docref(NULL, E_WARNING, "timeout must be between 0 and %d", (int)ceilf((double)INT_MAX / 1000));
|
||||
#ifdef CURLM_BAD_FUNCTION_ARGUMENT
|
||||
SAVE_CURLM_ERROR(mh, CURLM_BAD_FUNCTION_ARGUMENT);
|
||||
#endif
|
||||
RETURN_LONG(-1);
|
||||
zend_argument_value_error(2, "must be between 0 and %d", (int)ceilf((double)INT_MAX / 1000));
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
error = curl_multi_wait(mh->multi, NULL, 0, (int) (timeout * 1000.0), &numfds);
|
||||
|
||||
@@ -6,24 +6,24 @@ curl
|
||||
<?php
|
||||
|
||||
$mh = curl_multi_init();
|
||||
var_dump(curl_multi_select($mh, -2500000));
|
||||
var_dump(curl_multi_strerror(curl_multi_errno($mh)));
|
||||
|
||||
try {
|
||||
curl_multi_select($mh, -2500000);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
curl_multi_close($mh);
|
||||
$mh = curl_multi_init();
|
||||
var_dump(curl_multi_select($mh, 2500000));
|
||||
var_dump(curl_multi_strerror(curl_multi_errno($mh)));
|
||||
try {
|
||||
curl_multi_select($mh, 2500000);
|
||||
} catch (\ValueError $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
}
|
||||
curl_multi_close($mh);
|
||||
$mh = curl_multi_init();
|
||||
var_dump(curl_multi_select($mh, 1000000));
|
||||
var_dump(curl_multi_strerror(curl_multi_errno($mh)));
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: curl_multi_select(): timeout must be between 0 and %d in %s on line %d
|
||||
int(-1)
|
||||
%s
|
||||
|
||||
Warning: curl_multi_select(): timeout must be between 0 and %d in %s on line %d
|
||||
int(-1)
|
||||
%s
|
||||
curl_multi_select(): Argument #2 ($timeout) must be between %d and %d
|
||||
curl_multi_select(): Argument #2 ($timeout) must be between %d and %d
|
||||
int(0)
|
||||
string(8) "No error"
|
||||
|
||||
Reference in New Issue
Block a user