Add explicit check in TDecoratedCategoryLookupPageHandler for constant
authorMatthias Schmidt <gravatronics@live.com>
Sun, 18 Sep 2016 17:34:47 +0000 (19:34 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 18 Sep 2016 17:34:50 +0000 (19:34 +0200)
wcfsetup/install/files/lib/system/page/handler/TDecoratedCategoryLookupPageHandler.class.php

index ce2577085fd98c5faad369ccd395f32fcb04e651..c21df7092a55d95ff2403151893f356870bb552b 100644 (file)
@@ -58,6 +58,9 @@ trait TDecoratedCategoryLookupPageHandler {
                if (!is_subclass_of($className, AbstractDecoratedCategory::class)) {
                        throw new ParentClassException($className, AbstractDecoratedCategory::class);
                }
+               if (!defined($className.'::OBJECT_TYPE_NAME')) {
+                       throw new \LogicException("Class '{$className}' has no constant 'OBJECT_TYPE_NAME'.");
+               }
                
                $conditionBuilder = new PreparedStatementConditionBuilder();
                $conditionBuilder->add('category.objectTypeID = ?', [ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.category', $className::OBJECT_TYPE_NAME)]);