diff --git a/src/Symfony/Component/HttpClient/CurlHttpClient.php b/src/Symfony/Component/HttpClient/CurlHttpClient.php index e52a2cd0a5..632822b1ed 100644 --- a/src/Symfony/Component/HttpClient/CurlHttpClient.php +++ b/src/Symfony/Component/HttpClient/CurlHttpClient.php @@ -301,15 +301,20 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface public function __destruct() { $this->multi->pushedResponses = []; - if (\defined('CURLMOPT_PUSHFUNCTION')) { - curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null); + + if (\is_resource($this->multi->handle)) { + if (\defined('CURLMOPT_PUSHFUNCTION')) { + curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null); + } + + $active = 0; + while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active)); } - $active = 0; - while (CURLM_CALL_MULTI_PERFORM === curl_multi_exec($this->multi->handle, $active)); - foreach ($this->multi->openHandles as [$ch]) { - curl_setopt($ch, CURLOPT_VERBOSE, false); + if (\is_resource($ch)) { + curl_setopt($ch, CURLOPT_VERBOSE, false); + } } }