Skip to content

Commit 0b09830

Browse files
authored
Php 8.5 Support (#42)
* Avoid depreciation notice in PHP 8.5 * Add PHP 8.5 to tests * Remove dynamic property depreciation notice * Anticipate V1.6.4
1 parent aee1582 commit 0b09830

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
"5.6",
1717
"7.4",
1818
"8.0",
19-
"8.4",
19+
"8.5",
2020
]
2121
os: [ubuntu-latest, macOS-latest, windows-latest]
2222
steps:

lib/Tinify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Tinify;
44

5-
const VERSION = "1.6.3";
5+
const VERSION = "1.6.4";
66

77
class Tinify {
88
private static $key = NULL;

lib/Tinify/Client.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ function request($method, $url, $body = NULL) {
112112
if (is_string($response)) {
113113
$status = curl_getinfo($request, CURLINFO_HTTP_CODE);
114114
$headerSize = curl_getinfo($request, CURLINFO_HEADER_SIZE);
115-
curl_close($request);
115+
if (PHP_VERSION_ID < 80000) {
116+
curl_close($request);
117+
}
116118

117119
$headers = self::parseHeaders(substr($response, 0, $headerSize));
118120
$responseBody = substr($response, $headerSize);
@@ -140,7 +142,9 @@ function request($method, $url, $body = NULL) {
140142
throw Exception::create($details->message, $details->error, $status);
141143
} else {
142144
$message = sprintf("%s (#%d)", curl_error($request), curl_errno($request));
143-
curl_close($request);
145+
if (PHP_VERSION_ID < 80000) {
146+
curl_close($request);
147+
}
144148
if ($retries > 0) continue;
145149
throw new ConnectionException("Error while connecting: " . $message);
146150
}

test/curl_mock.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class CurlMock {
1717
private static $version = array();
1818

1919
public $options = array();
20+
public $request;
2021
public $response;
2122
public $closed = false;
2223

0 commit comments

Comments
 (0)