From 222ce04757bc5f938007928765f73f60c738ce06 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Sun, 25 Jul 2021 17:19:10 +0100 Subject: [PATCH] Check for "NULL" page in addPages so we don't crash when calling require_once --- CRM/Core/Controller.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index 0a5f6482e8d5..df2c08d38449 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -433,6 +433,11 @@ public function setStateMachine($stateMachine) { public function addPages(&$stateMachine, $action = CRM_Core_Action::NONE) { $pages = $stateMachine->getPages(); foreach ($pages as $name => $value) { + if (empty($name)) { + // An "empty" page can happen eg. when triggered from a StateMachine/Search class + // when there are no SearchTasks defined. + continue; + } $className = CRM_Utils_Array::value('className', $value, $name); $title = $value['title'] ?? NULL; $options = $value['options'] ?? NULL;