From 4ca754e644fc14934e4eeb0cccf46093287c2b47 Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 16 Jan 2026 15:56:02 +0000 Subject: [PATCH] Conditionally close the curl handle `curl_close` has no effect since PHP 8.0 and is deprecated since 8.5 https://www.php.net/curl_close --- MatomoTracker.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MatomoTracker.php b/MatomoTracker.php index d2ce799..b40606b 100644 --- a/MatomoTracker.php +++ b/MatomoTracker.php @@ -2141,7 +2141,11 @@ protected function sendRequest(string $url, string $method = 'GET', $data = null $this->parseIncomingCookies(explode("\r\n", $header)); } finally { - curl_close($ch); + // curl_close has no effect since PHP 8.0 + if (PHP_VERSION_ID < 80000) { + curl_close($ch); + } + ob_end_clean(); } } elseif (function_exists('stream_context_create')) {