From: Matthias Schmidt Date: Mon, 22 Jun 2015 17:28:17 +0000 (+0200) Subject: Fix instanceof checks X-Git-Tag: 3.0.0_Beta_1~2249^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a0817a61b8dff27e7974e1d4cc9a1e7b8500146;p=GitHub%2FWoltLab%2FWCF.git Fix instanceof checks --- diff --git a/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php b/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php index d5e1088033..585b7a6785 100644 --- a/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php @@ -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]); } diff --git a/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php b/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php index 7972e5448c..9008bc4ab6 100644 --- a/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php +++ b/wcfsetup/install/files/lib/system/condition/AbstractTimestampCondition.class.php @@ -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;