From 1d0c1fa368d0eb89cb75d49a970125adeadfbc54 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 3 Mar 2015 17:13:25 +0100 Subject: [PATCH] Fix searching for menu items in the ACP --- .../search/acp/MenuItemACPSearchResultProvider.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php b/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php index 41fad90497..3fabb36b7c 100644 --- a/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php +++ b/wcfsetup/install/files/lib/system/search/acp/MenuItemACPSearchResultProvider.class.php @@ -61,17 +61,20 @@ class MenuItemACPSearchResultProvider extends AbstractACPSearchResultProvider im $statement = WCF::getDB()->prepareStatement($sql); // don't use a limit here $statement->execute($conditions->getParameters()); + $menuItems = ACPMenu::getInstance()->menuItemList; while ($menuItem = $statement->fetchObject('wcf\data\acp\menu\item\ACPMenuItem')) { - if (!$this->validate($menuItem)) { + // only valid menu items exist in TreeMenu::$menuItemList, + // so no need to call AbstractACPSearchResultProvider::validate() + if (!isset($menuItems[$menuItem->menuItem])) { continue; } $parentMenuItem = $menuItem->parentMenuItem; $parentMenuItems = array(); - while ($parentMenuItem && isset(ACPMenu::getInstance()->menuItems[$parentMenuItem])) { + while ($parentMenuItem && isset($menuItems[$parentMenuItem])) { array_unshift($parentMenuItems, $parentMenuItem); - $parentMenuItem = ACPMenu::getInstance()->menuItemList[$parentMenuItem]->parentMenuItem; + $parentMenuItem = $menuItems[$parentMenuItem]->parentMenuItem; } $results[] = new ACPSearchResult($languageItems[$menuItem->menuItem], $menuItem->getLink(), WCF::getLanguage()->getDynamicVariable('wcf.acp.search.result.subtitle', array( 'pieces' => $parentMenuItems -- 2.20.1