Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
"5.6",
"7.4",
"8.0",
"8.4",
"8.5",
]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
Expand Down
2 changes: 1 addition & 1 deletion lib/Tinify.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Tinify;

const VERSION = "1.6.3";
const VERSION = "1.6.4";

class Tinify {
private static $key = NULL;
Expand Down
8 changes: 6 additions & 2 deletions lib/Tinify/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ function request($method, $url, $body = NULL) {
if (is_string($response)) {
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
$headerSize = curl_getinfo($request, CURLINFO_HEADER_SIZE);
curl_close($request);
if (PHP_VERSION_ID < 80000) {
curl_close($request);
}

$headers = self::parseHeaders(substr($response, 0, $headerSize));
$responseBody = substr($response, $headerSize);
Expand Down Expand Up @@ -140,7 +142,9 @@ function request($method, $url, $body = NULL) {
throw Exception::create($details->message, $details->error, $status);
} else {
$message = sprintf("%s (#%d)", curl_error($request), curl_errno($request));
curl_close($request);
if (PHP_VERSION_ID < 80000) {
curl_close($request);
}
if ($retries > 0) continue;
throw new ConnectionException("Error while connecting: " . $message);
}
Expand Down
1 change: 1 addition & 0 deletions test/curl_mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CurlMock {
private static $version = array();

public $options = array();
public $request;
public $response;
public $closed = false;

Expand Down