From 1f2ff09a8b27e2d35e17f98e76f63a38797f8617 Mon Sep 17 00:00:00 2001 From: sangege Date: Sun, 12 Jul 2026 04:36:25 +0800 Subject: [PATCH] fix #2435 handle missing event names in webhook dispatcher (#2440) --- app/Listeners/DispatchWebhooks.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/Listeners/DispatchWebhooks.php b/app/Listeners/DispatchWebhooks.php index cdeec8f27..56f493bdf 100644 --- a/app/Listeners/DispatchWebhooks.php +++ b/app/Listeners/DispatchWebhooks.php @@ -100,6 +100,10 @@ class DispatchWebhooks { $eventName = $activityLogged->model->event; + if ($eventName === null) { + return; + } + if (!$activityLogged->isServerEvent()) { return; } @@ -177,6 +181,10 @@ class DispatchWebhooks $eventName = $activityLogged->model->event; $activityLoggedClass = ActivityLogged::class; + if ($eventName === null) { + return; + } + $matchingHooks = collect(); if ($this->eventIsWatched($eventName)) { @@ -210,8 +218,12 @@ class DispatchWebhooks } } - protected function eventIsWatched(string $eventName): bool + protected function eventIsWatched(?string $eventName): bool { + if ($eventName === null) { + return false; + } + $watchedEvents = cache()->rememberForever('watchedWebhooks', function () { return WebhookConfiguration::where('scope', WebhookScope::Global) ->pluck('events')