diff --git a/CHANGES.md b/CHANGES.md index ad87373..7a0c177 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ ## 1.6.4 * Will use POST instead of GET when retrieving result. +* Remove deprecated `curl_close` for PHP version 8. https://www.php.net/manual/en/function.curl-close.php. +* Support PHP `8.5`. ## 1.6.3 * Add minimum TLS 1.2 version to curl options as protocol negotiation on certain openssl/libcurl versions is flaky. diff --git a/lib/Tinify/Client.php b/lib/Tinify/Client.php index 93bd513..0d8ed0c 100644 --- a/lib/Tinify/Client.php +++ b/lib/Tinify/Client.php @@ -114,6 +114,8 @@ function request($method, $url, $body = NULL) { $headerSize = curl_getinfo($request, CURLINFO_HEADER_SIZE); if (PHP_VERSION_ID < 80000) { curl_close($request); + } else { + unset($request); } $headers = self::parseHeaders(substr($response, 0, $headerSize)); @@ -144,6 +146,8 @@ function request($method, $url, $body = NULL) { $message = sprintf("%s (#%d)", curl_error($request), curl_errno($request)); if (PHP_VERSION_ID < 80000) { curl_close($request); + } else { + unset($request); } if ($retries > 0) continue; throw new ConnectionException("Error while connecting: " . $message);