From 4fb47ef768d143a5b40c89c6a3f97c5880455310 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Thu, 4 Sep 2014 12:15:24 +0200 Subject: [PATCH] Hook classes: Add class suffix if not exist refs #7066 refs #7067 refs #7068 --- library/Icinga/Web/Hook.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Web/Hook.php b/library/Icinga/Web/Hook.php index b88069da1..8e65bb33c 100644 --- a/library/Icinga/Web/Hook.php +++ b/library/Icinga/Web/Hook.php @@ -123,7 +123,12 @@ class Hook */ private static function assertValidHook($instance, $name) { - $base_class = self::$BASE_NS . ucfirst($name) . self::$classSuffix; + $base_class = self::$BASE_NS . ucfirst($name); + + if (strpos($base_class, self::$classSuffix) === false) { + $base_class .= self::$classSuffix; + } + if (!$instance instanceof $base_class) { throw new ProgrammingError( '%s is not an instance of %s',