修复 PHP 8.5 中 curl_close() 弃用警告 (#1924)

* 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>
This commit is contained in:
Copilot
2025-11-27 11:37:42 +08:00
committed by GitHub
parent 9364388035
commit 4079a64a88

View File

@@ -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);
}
}
/**