From c3ad665c15a7809f9d8c5dc0a7bbe5dded28e3d4 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 3 Sep 2015 12:52:07 +0200 Subject: [PATCH] Navigation: Fix accessing a non-existent and static variable refs #5600 --- library/Icinga/Web/Navigation/Navigation.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Web/Navigation/Navigation.php b/library/Icinga/Web/Navigation/Navigation.php index 15bab5a8c..24b60ba41 100644 --- a/library/Icinga/Web/Navigation/Navigation.php +++ b/library/Icinga/Web/Navigation/Navigation.php @@ -132,10 +132,11 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate } $itemType = isset($properties['type']) ? String::cname($properties['type'], '-') : 'NavigationItem'; - if (! empty($this->types) && isset($this->types[$itemType])) { - return new $this->types[$itemType]($name, $properties); + if (! empty(static::$types) && isset(static::$types[$itemType])) { + return new static::$types[$itemType]($name, $properties); } + $item = null; foreach (Icinga::app()->getModuleManager()->getLoadedModules() as $module) { $classPath = 'Icinga\\Module\\' . $module->getName() . '\\' . static::NAVIGATION_NS . '\\' . $itemType; if (class_exists($classPath)) { @@ -159,11 +160,11 @@ class Navigation implements ArrayAccess, Countable, IteratorAggregate ); $item = new NavigationItem($name, $properties); - $this->types[$itemType] = 'Icinga\\Web\\Navigation\\NavigationItem'; + static::$types[$itemType] = 'Icinga\\Web\\Navigation\\NavigationItem'; } elseif (! $item instanceof NavigationItem) { throw new ProgrammingError('Class %s must inherit from NavigationItem', $classPath); } else { - $this->types[$itemType] = $classPath; + static::$types[$itemType] = $classPath; } return $item;