diff --git a/api/gh_cfg.php b/api/gh_cfg.php index 4abc2ed..5be74e8 100644 --- a/api/gh_cfg.php +++ b/api/gh_cfg.php @@ -9,6 +9,10 @@ */ while (ob_get_level() > 0) { @ob_end_clean(); } ob_start(); +// ★ 15m44w 续5c 根治横条消失:PHP8.5 下 deprecation/notice 输出
污染 JSON 响应体, +// 前端 res.json() 解析失败进 catch → 授权横条不显示。抑制一切错误输出保响应体纯净。 +error_reporting(0); +ini_set('display_errors', '0'); header('Content-Type: application/json; charset=utf-8'); header('X-Content-Type-Options: nosniff'); header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); diff --git a/api/gh_diag.php b/api/gh_diag.php index 20c0f3f..2caa5c1 100644 --- a/api/gh_diag.php +++ b/api/gh_diag.php @@ -6,6 +6,10 @@ */ while (ob_get_level() > 0) { @ob_end_clean(); } ob_start(); +// ★ 15m44w 续5c:PHP8.5 下 deprecation/notice 会输出
污染 JSON 响应体致前端 res.json() 失败, +// 抑制一切错误输出,保证响应体纯净(curl_close 已删, 此为其它警告兜底)。 +error_reporting(0); +ini_set('display_errors', '0'); header('Content-Type: application/json; charset=utf-8'); header('X-Content-Type-Options: nosniff'); header('Cache-Control: no-store'); diff --git a/api/gh_git_probe.php b/api/gh_git_probe.php index 06de5e0..624f536 100644 --- a/api/gh_git_probe.php +++ b/api/gh_git_probe.php @@ -6,6 +6,9 @@ */ while (ob_get_level() > 0) { @ob_end_clean(); } ob_start(); +// ★ 15m44w 续5c:抑制 deprecation/notice 输出,保 JSON 响应体纯净(PHP8.5) +error_reporting(0); +ini_set('display_errors', '0'); header('Content-Type: application/json; charset=utf-8'); header('Cache-Control: no-store'); @@ -56,7 +59,6 @@ if ($ir['full'] !== '' && $ir['owner'] !== '') { curl_exec($ch); $reachStatus = (int)curl_getinfo($ch, CURLINFO_RESPONSE_CODE); $reach = 'HTTP ' . $reachStatus; - curl_close($ch); } } diff --git a/api/gh_oauth.php b/api/gh_oauth.php index e2ee4fb..74f098f 100644 --- a/api/gh_oauth.php +++ b/api/gh_oauth.php @@ -126,7 +126,6 @@ if ($code !== '') { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $body = curl_exec($ch); $errno = curl_errno($ch); - curl_close($ch); if ($errno) { header('Content-Type: text/html; charset=utf-8'); echo '

获取 GitHub token 失败(cURL ' . htmlspecialchars((string)$errno) . ')。

'; diff --git a/api/minecraft_auth.php b/api/minecraft_auth.php index b1abbf8..5de8187 100644 --- a/api/minecraft_auth.php +++ b/api/minecraft_auth.php @@ -187,8 +187,7 @@ function msPost($url, $data, $headers = []) { $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); - curl_close($ch); - + // 15m44w 续5c:删 curl_close(PHP8.5 deprecation 污染响应体) // 详细日志记录 $log = date('Y-m-d H:i:s') . "\n"; $log .= "URL: $url\n"; @@ -225,8 +224,7 @@ function msGet($url, $headers = []) { $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); - curl_close($ch); - + // 15m44w 续5c:删 curl_close(PHP8.5 deprecation 污染响应体) // 详细日志记录 $log = date('Y-m-d H:i:s') . "\n"; $log .= "GET URL: $url\n"; diff --git a/api/pay.php b/api/pay.php index 3d4c769..47a1ebe 100644 --- a/api/pay.php +++ b/api/pay.php @@ -629,7 +629,7 @@ function triggerPollerAsync() { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 不等待结果,后台执行 curl_exec($ch); - curl_close($ch); + // 15m44w 续5c:删 curl_close(PHP8.5 deprecation 污染响应体) } // ==================================================================== @@ -905,8 +905,7 @@ function queryPlatformAPI($outTradeNo) { $err = curl_error($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $elapsed = curl_getinfo($ch, CURLINFO_TOTAL_TIME); - curl_close($ch); - + // 15m44w 续5c:删 curl_close(PHP8.5 deprecation 污染响应体) debugLog('[queryPlatformAPI] curl完成', [ 'http_code' => $code, 'elapsed_s' => round($elapsed, 3), diff --git a/api/wallpaper.php b/api/wallpaper.php index 892d76a..acf3225 100644 --- a/api/wallpaper.php +++ b/api/wallpaper.php @@ -65,7 +65,7 @@ function wpjFetch($url, $timeout, $referer) { CURLOPT_REFERER => $referer, )); $body = curl_exec($ch); - curl_close($ch); + // 15m44w 续5c:删 curl_close(PHP8.5 deprecation 污染响应体) return is_string($body) ? $body : ''; } $ctx = stream_context_create(array('http' => array( diff --git a/gh_api.php b/gh_api.php index 7d9cce3..2b0c336 100644 --- a/gh_api.php +++ b/gh_api.php @@ -82,7 +82,8 @@ function ghApiRequest($method, $path, $payload = null, $token = null) { $errno = curl_errno($ch); $err = curl_error($ch); $status = (int)curl_getinfo($ch, CURLINFO_RESPONSE_CODE); - curl_close($ch); + // ★ 15m44w 续5c:删 curl_close(PHP8.0+ 是 no-op, 8.5 报 deprecation 警告污染 JSON 响应体, + // 致前端 res.json() 解析失败 → GitHub 授权横条消失)。PHP8 下 $ch 出作用域自动关闭。 if ($errno) return ['ok' => false, 'status' => 0, 'msg' => 'cURL ' . $errno . ': ' . $err, 'data' => null]; $j = json_decode((string)$body, true); $msg = (is_array($j) && isset($j['message']) && $j['message'] !== '') diff --git a/lsky.php b/lsky.php index d8f2f44..25e6ee6 100644 --- a/lsky.php +++ b/lsky.php @@ -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]; }