fix(chat): 避免群信息查不到时对 null 取下标(PHP 7.4 报错)

processMessage 中 room_id 未在 Rooms/qiweRooms 表中登记时,find() 返回
null,PHP 7.4 起取 ['type'] 会抛 Trying to access array offset on value
of type null。改用 ?? 取默认 null,行为与升级前一致:落 switch default
返回"群聊类型未命中"。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liufumingren 2026-10-22 14:13:57 +08:00
parent 8d56189d4e
commit a73f3b1c2a

View File

@ -525,11 +525,11 @@ class Chat extends Frontend
switch($this->SOURCE){
case "wx":
$roominfo = $this->RoomsModel->where(["room_id"=>$fromid])->find();
$roomtype = $roominfo['type'];
$roomtype = $roominfo['type'] ?? null;
break;
case "qiwe":
$roominfo = $this->qiweRoomsModel->where(["room_id"=>$fromid])->find();
$roomtype = $roominfo['type'];
$roomtype = $roominfo['type'] ?? null;
Log::error("企微的查找群信息".json_encode($roominfo));
break;
default: