Fix instanceof checks
authorMatthias Schmidt <gravatronics@live.com>
Mon, 22 Jun 2015 17:28:17 +0000 (19:28 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 22 Jun 2015 17:28:17 +0000 (19:28 +0200)
wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php
wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php

index d5e10880339eb6355b25ea9f5272bb524914fcb7..585b7a67852ab41785f03e4f939161638841a10d 100644 (file)
@@ -2,7 +2,6 @@
 namespace wcf\system\condition;
 use wcf\data\DatabaseObject;
 use wcf\data\DatabaseObjectList;
-use wcf\util\ClassUtil;
 
 /**
  * Abstract condition implementation for check a text-typed property of a database
@@ -39,7 +38,8 @@ abstract class AbstractObjectTextPropertyCondition extends AbstractTextCondition
         * @see \wcf\system\condition\IObjectListCondition::addObjectListCondition()
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
-               if (!ClassUtil::isInstanceOf($objectList, $this->getListClassName())) return;
+               $className = $this->getListClassName();
+               if (!($objectList instanceof $className)) return;
                
                if ($this->supportsMultipleValues) {
                        $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' IN (?)', [ $conditionData[$this->fieldName] ]);
@@ -53,7 +53,8 @@ abstract class AbstractObjectTextPropertyCondition extends AbstractTextCondition
         * @see \wcf\system\condition\IObjectCondition::checkObject()
         */
        public function checkObject(DatabaseObject $object, array $conditionData) {
-               if (!ClassUtil::isInstanceOf($object, $this->getClassName())) return;
+               $className = $this->getClassName();
+               if (!($object instanceof $className)) return;
                
                return in_array($object->{$this->getPropertyName()}, $conditionData[$this->fieldName]);
        }
index 7972e5448c8731393c24f75f4f0f930ed8568cab..9008bc4ab6861cb4581f080b5e38f5fba178019f 100644 (file)
@@ -7,7 +7,6 @@ use wcf\data\DatabaseObject;
 use wcf\data\DatabaseObjectList;
 use wcf\system\exception\UserInputException;
 use wcf\system\WCF;
-use wcf\util\ClassUtil;
 
 /**
  * Condition implementation for compairing a user-bound timestamp with a fixed time
@@ -49,7 +48,8 @@ abstract class AbstractTimestampCondition extends AbstractSingleFieldCondition i
         * @see \wcf\system\condition\IObjectListCondition::addObjectListCondition()
         */
        public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) {
-               if (!ClassUtil::isInstanceOf($objectList, $this->getListClassName())) return;
+               $className = $this->getListClassName();
+               if (!($objectList instanceof $className)) return;
                
                $objectList->getConditionBuilder()->add($objectList->getDatabaseTableAlias().'.'.$this->getPropertyName().' <> ?', [ 0 ]);
                if (isset($conditionData['endTime'])) {
@@ -64,7 +64,8 @@ abstract class AbstractTimestampCondition extends AbstractSingleFieldCondition i
         * @see \wcf\system\condition\IObjectCondition::checkObject()
         */
        public function checkObject(DatabaseObject $object, array $conditionData) {
-               if (!ClassUtil::isInstanceOf($object, $this->getClassName())) return;
+               $className = $this->getClassName();
+               if (!($object instanceof $className)) return;
                
                if (isset($conditionData['startTime']) && $object->{$this->getPropertyName()} < strtotime($conditionData['startTime'])) {
                        return false;