diff --git a/src/EventListener/AdminRouterSubscriber.php b/src/EventListener/AdminRouterSubscriber.php index 6fc0212859..b8f7be4417 100644 --- a/src/EventListener/AdminRouterSubscriber.php +++ b/src/EventListener/AdminRouterSubscriber.php @@ -93,9 +93,12 @@ public function onKernelRequestPrettyUrls(RequestEvent $event): void // custom EasyAdmin route defaults/attributes to other existing Symfony routes. So, we have to // check if the route of the current request matches any of the cached dashboard routes $dashboardRoutesCachePath = $this->buildDir.'/'.CacheWarmer::DASHBOARD_ROUTES_CACHE; - $dashboardControllerRoutes = !file_exists($dashboardRoutesCachePath) ? [] : require $dashboardRoutesCachePath; + $dashboardControllerRoutes = []; + if (file_exists($dashboardRoutesCachePath)) { + $dashboardControllerRoutes = require $dashboardRoutesCachePath; + } // this is not a cached dashboard route, so this is case (3) a regular Symfony request - if (!array_key_exists($request->attributes->get('_route'), $dashboardControllerRoutes)) { + if (!\array_key_exists($request->attributes->get('_route'), $dashboardControllerRoutes)) { return; } }