Skip to content

Commit e6a0a73

Browse files
authored
PHP 8.5: Prevent deprecation notices for curl_close
`curl_close` is deprecated in PHP 8.5+, and hasn't been doing anything since PHP 8.0. To prevent deprecation warnings it should therefore be called on older versions of PHP only. See https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_no-op_functions_from_the_resource_to_object_conversion.
1 parent 8382ce9 commit e6a0a73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Transport/Curl.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function __construct() {
127127
* Destructor
128128
*/
129129
public function __destruct() {
130-
if (is_resource($this->handle)) {
130+
if (is_resource($this->handle) && \PHP_VERSION_ID < 80000) {
131131
curl_close($this->handle);
132132
}
133133
}
@@ -323,7 +323,9 @@ public function request_multiple($requests, $options) {
323323
}
324324

325325
curl_multi_remove_handle($multihandle, $done['handle']);
326-
curl_close($done['handle']);
326+
if (\PHP_VERSION_ID < 80000) {
327+
curl_close($done['handle']);
328+
}
327329

328330
if (!is_string($responses[$key])) {
329331
$options['hooks']->dispatch('multiple.request.complete', [&$responses[$key], $key]);

0 commit comments

Comments
 (0)