Added check for interface existence
authorAlexander Ebert <ebert@woltlab.com>
Wed, 29 Mar 2017 12:30:52 +0000 (14:30 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 29 Mar 2017 13:08:02 +0000 (15:08 +0200)
wcfsetup/install/files/lib/data/object/type/ObjectType.class.php

index f78430db0dccf3faa98fa2659ebfd7a379f09328..fde945aff379c8db2c8c112e101c1e6eca41b3a7 100644 (file)
@@ -80,8 +80,16 @@ class ObjectType extends ProcessibleDatabaseObject {
                                if (!class_exists($this->className)) {
                                        throw new SystemException("Unable to find class '".$this->className."'");
                                }
-                               if (($definitionInterface = ObjectTypeCache::getInstance()->getDefinition($this->definitionID)->interfaceName) && !is_subclass_of($this->className, $definitionInterface)) {
-                                       throw new ImplementationException($this->className, $definitionInterface);
+                               
+                               $definitionInterface = ObjectTypeCache::getInstance()->getDefinition($this->definitionID)->interfaceName;
+                               if ($definitionInterface) {
+                                       if (!interface_exists($definitionInterface)) {
+                                               throw new SystemException("Unable to find interface '".$definitionInterface."'");
+                                       }
+                                       
+                                       if (!is_subclass_of($this->className, $definitionInterface)) {
+                                               throw new ImplementationException($this->className, $definitionInterface);
+                                       }
                                }
                                
                                if (is_subclass_of($this->className, SingletonFactory::class)) {