From 82b7a657d3b64ba4d183b03de6345bb0464d0f34 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 17 Aug 2012 16:57:29 +0200 Subject: [PATCH] ClassUtil::isInstanceOf() now validates parameters From now on, a SystemException is thrown whenever $className or $targetClass do not exists, preventing misleading errors about missing implementation. --- .../files/lib/util/ClassUtil.class.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/lib/util/ClassUtil.class.php b/wcfsetup/install/files/lib/util/ClassUtil.class.php index ffc9d2010c..0e51d3732f 100644 --- a/wcfsetup/install/files/lib/util/ClassUtil.class.php +++ b/wcfsetup/install/files/lib/util/ClassUtil.class.php @@ -1,5 +1,6 @@ implementsInterface($targetClass); - } - return false; + // check for interface + $reflectionClass = new \ReflectionClass($className); + return $reflectionClass->implementsInterface($targetClass); } private function __construct() { } -- 2.20.1