From f190f7a347847234393852a34f77f06f0a942b3d Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Mon, 12 Aug 2019 22:16:34 +0800 Subject: [PATCH] Fix exception on middleware loader An exception was thrown when loading middleware if a requested controller is from a disabled plugin, as the `getRequestedController` method returns a Response object in this scenario. Hat tip to @w20k. --- modules/backend/classes/BackendController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/backend/classes/BackendController.php b/modules/backend/classes/BackendController.php index 7ccbfdd55..24a54465a 100644 --- a/modules/backend/classes/BackendController.php +++ b/modules/backend/classes/BackendController.php @@ -77,7 +77,11 @@ class BackendController extends ControllerBase $path = implode('/', $pathParts); $requestedController = $this->getRequestedController($path); - if (!is_null($requestedController) && count($requestedController['controller']->getMiddleware())) { + if ( + !is_null($requestedController) + && is_array($requestedController) + && count($requestedController['controller']->getMiddleware()) + ) { $action = $requestedController['action']; // Collect applicable middleware and insert middleware into pipeline