Skip to content

Commit 1d06ab8

Browse files
authored
Merge pull request #569 from sandfoxme/php-85-curl
Remove calls to curl_close and curl_multi_close on PHP 8.0 and later
2 parents 7aa590c + c056aab commit 1d06ab8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Http/CurlDispatcher.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ public static function fetch(array $settings, ResponseFactoryInterface $response
9999
curl_multi_remove_handle($multi, $curlHandle);
100100
}
101101

102-
curl_multi_close($multi);
102+
if (PHP_VERSION_ID < 80000) {
103+
curl_multi_close($multi);
104+
}
103105

104106
return array_map(
105107
fn ($connection) => $connection->getResponse($responseFactory),
@@ -160,8 +162,10 @@ private function getResponse(ResponseFactoryInterface $responseFactory): Respons
160162
$this->error(curl_error($curlHandle), $errno);
161163
}
162164

163-
/** @phpstan-ignore argument.type (PHP 7.4/8.0 compatibility) */
164-
curl_close($curlHandle);
165+
if (PHP_VERSION_ID < 80000) {
166+
/** @phpstan-ignore argument.type (PHP 7.4/8.0 compatibility) */
167+
curl_close($curlHandle);
168+
}
165169

166170
$response = $responseFactory->createResponse($info['http_code']);
167171

0 commit comments

Comments
 (0)