From 4079a64a8889f2fc231a2c8c4081ef848c89bd6a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 11:37:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20PHP=208.5=20=E4=B8=AD=20cu?= =?UTF-8?q?rl=5Fclose()=20=E5=BC=83=E7=94=A8=E8=AD=A6=E5=91=8A=20(#1924)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial plan * 移除 curl_close() 调用以修复 PHP 8.5 弃用警告 Co-authored-by: joyqi <59437+joyqi@users.noreply.github.com> * 使用 PHP 版本检查兼容 PHP 7.4 的 curl_close 处理 Co-authored-by: joyqi <59437+joyqi@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: joyqi <59437+joyqi@users.noreply.github.com> --- var/Typecho/Http/Client.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/var/Typecho/Http/Client.php b/var/Typecho/Http/Client.php index 3a1083f8..3a63e921 100644 --- a/var/Typecho/Http/Client.php +++ b/var/Typecho/Http/Client.php @@ -337,13 +337,21 @@ class Client $response = curl_exec($ch); if (false === $response) { $error = curl_error($ch); - curl_close($ch); + if (PHP_VERSION_ID >= 80000) { + unset($ch); + } else { + curl_close($ch); + } throw new Exception($error, 500); } $this->responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); $this->responseBody = $response; - curl_close($ch); + if (PHP_VERSION_ID >= 80000) { + unset($ch); + } else { + curl_close($ch); + } } /**