Validate menu items for their object's existence
authorAlexander Ebert <ebert@woltlab.com>
Thu, 6 Dec 2018 13:46:01 +0000 (14:46 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 6 Dec 2018 13:46:01 +0000 (14:46 +0100)
Fixes #2778

wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php

index 2c4d0078ca6b0b201ca048fdc04742a9fe1a259f..0a35cbf12b5249e10a1efd5625506f6b17c470b9 100644 (file)
@@ -118,7 +118,12 @@ class MenuItem extends DatabaseObject {
                }
                
                if ($this->getMenuPageHandler() !== null) {
-                       return $this->getMenuPageHandler()->isVisible($this->pageObjectID ?: null);
+                       $menuPageHandler = $this->getMenuPageHandler();
+                       if ($menuPageHandler instanceof ILookupPageHandler && !$menuPageHandler->isValid($this->pageObjectID ?: null)) {
+                               return false;
+                       }
+                       
+                       return $menuPageHandler->isVisible($this->pageObjectID ?: null);
                }
                
                return true;