15m44w 续5c 根治横条消失: 删全仓 curl_close + JSON 端点抑制 deprecation 输出

真根因(推翻 token 过期说): PHP8.5 下 curl_close() 已废弃, 每次调用都输出
<br><b>Deprecated</b> 污染 JSON 响应体 → 前端 res.json() 解析失败进 catch
(端点 catch 注释'不显示') → GitHub 授权横条消失。实测 gh_cfg 后端验活 status=200
ok=true 但响应体被警告污染, 非纯 JSON。

修: ① 全仓 8 处独立 curl_close 语句删除(PHP8+ 是 no-op,  出作用域自动关闭,
   删了不改行为还消除 deprecation 源头); ② gh_cfg/gh_diag/gh_git_probe 顶部加
   error_reporting(0)+display_errors=0 兜底, 彻底防任何警告污染响应体。
实测部署后 gh_cfg.php 返回纯 JSON, gh_authorized=true。
This commit is contained in:
ypsdf1
2026-11-25 20:40:38 +08:00
parent a199874c5c
commit a8ac78a87f
9 changed files with 20 additions and 14 deletions
+2 -3
View File
@@ -257,7 +257,7 @@ function easyUploadFile($tmpPath, $origName) {
$errno = curl_errno($ch);
$err = curl_error($ch);
$status = (int)curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
// 15m44w 续5c:删 curl_close(PHP8.5 deprecation 污染响应体), $ch 出作用域自动关闭
if ($errno) return ['ok' => false, 'msg' => 'cURL错误: ' . $err];
$j = json_decode((string)$body, true);
// EasyImages2.0 成功: {result:"success", url:..., thumb:...};失败: {result:"failed", message:...} 或 code!=200
@@ -357,8 +357,7 @@ function lskyCurlJson($method, $url, $payload = null, $token = null, $isMultipar
$errno = curl_errno($ch);
$err = curl_error($ch);
$status = (int)curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
// 15m44w 续5c:删 curl_close(PHP8.5 deprecation 污染响应体)
if ($errno) {
return ['ok' => false, 'status' => 0, 'msg' => 'cURL错误: ' . $err, 'data' => null];
}