diff --git a/src/Client/CurlHandler.php b/src/Client/CurlHandler.php index e00aa4e..4115c49 100644 --- a/src/Client/CurlHandler.php +++ b/src/Client/CurlHandler.php @@ -50,6 +50,9 @@ public function __construct(array $options = []) public function __destruct() { + if (PHP_VERSION_ID >= 80000) { + return; + } foreach ($this->handles as $handle) { if (is_resource($handle)) { curl_close($handle); @@ -117,7 +120,9 @@ private function releaseEasyHandle($handle) { $id = (int) $handle; if (count($this->ownedHandles) > $this->maxHandles) { - curl_close($this->handles[$id]); + if (PHP_VERSION_ID < 80000) { + curl_close($this->handles[$id]); + } unset($this->handles[$id], $this->ownedHandles[$id]); } else { // curl_reset doesn't clear these out for some reason diff --git a/src/Client/CurlMultiHandler.php b/src/Client/CurlMultiHandler.php index 5bb3962..8a83444 100644 --- a/src/Client/CurlMultiHandler.php +++ b/src/Client/CurlMultiHandler.php @@ -174,7 +174,9 @@ private function removeProcessed($id) $this->_mh, $this->handles[$id]['handle'] ); - curl_close($this->handles[$id]['handle']); + if (PHP_VERSION_ID < 80000) { + curl_close($this->handles[$id]['handle']); + } unset($this->handles[$id], $this->delays[$id]); } } @@ -196,8 +198,9 @@ private function cancel($id) $handle = $this->handles[$id]['handle']; unset($this->delays[$id], $this->handles[$id]); curl_multi_remove_handle($this->_mh, $handle); - curl_close($handle); - + if (PHP_VERSION_ID < 80000) { + curl_close($handle); + } return true; } diff --git a/tests/Client/CurlFactoryTest.php b/tests/Client/CurlFactoryTest.php index de5d0e5..bc5f420 100644 --- a/tests/Client/CurlFactoryTest.php +++ b/tests/Client/CurlFactoryTest.php @@ -72,7 +72,9 @@ public function testCreatesCurlHandle() $this->assertIsArray($result[1]); $this->assertSame($stream, $result[2]); - curl_close($result[0]); + if (PHP_VERSION_ID < 80000) { + curl_close($result[0]); + } $this->assertEquals('PUT', $_SERVER['_curl'][CURLOPT_CUSTOMREQUEST]); $this->assertEquals(