[HttpClient] Declare $active first to prevent weird issue

This commit is contained in:
Hugo Alliaume 2019-08-06 15:20:03 +02:00 committed by Nicolas Grekas
parent 36466a3ab5
commit ba030f0022
2 changed files with 3 additions and 0 deletions

View File

@ -290,6 +290,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of CurlResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
}
$active = 0;
while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active));
return new ResponseStream(CurlResponse::stream($responses, $timeout));
@ -302,6 +303,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null);
}
$active = 0;
while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active));
foreach ($this->multi->openHandles as $ch) {

View File

@ -255,6 +255,7 @@ final class CurlResponse implements ResponseInterface
try {
self::$performing = true;
$active = 0;
while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($multi->handle, $active));
while ($info = curl_multi_info_read($multi->handle)) {