From ca4a5f4e4e97f597dc5395aa7415d6e5443bf7ce Mon Sep 17 00:00:00 2001 From: biss Date: Sun, 4 Oct 2026 14:42:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=81=BF=E5=85=8D=E6=88=91=E7=9A=84?= =?UTF-8?q?=E6=A1=8C=E9=9D=A2=E8=AF=BB=E5=8F=96=E7=A9=BA=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为服务器地址和软件标识逐字段提供非空兜底,避免模板在 PHP 8.5 下以 null 作为数组偏移量。 --- app/index/controller/Index.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index d988ed5f..06756a49 100755 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -58,12 +58,13 @@ class Index extends AdminBase $list['group'] = $admin->searchOne(session('user_id'))->groupnames; - $list['server'] = array_replace([ - // PHP's built-in server does not populate these Apache-specific - // entries; provide portable values for the dashboard. - 'SERVER_ADDR' => request()->host(), - 'SERVER_SOFTWARE' => PHP_SAPI, - ], request()->server()); + $server = request()->server(); + $list['server'] = [ + // Some web servers expose these keys with null values. Keep the + // template input non-null so it can safely access both entries. + 'SERVER_ADDR' => $server['SERVER_ADDR'] ?? request()->host(), + 'SERVER_SOFTWARE' => $server['SERVER_SOFTWARE'] ?? PHP_SAPI, + ]; // 获取系统版本号 $list->version = config('shangma.version'); // 获取php版本号