From 615dbd9802c19ec31244741edc23aa7ea233da75 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 12 Jun 2013 22:24:26 +0400 Subject: [PATCH] used strcmp instead of complex comparison, code formatting --- framework/validators/CRangeValidator.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/validators/CRangeValidator.php b/framework/validators/CRangeValidator.php index 3ae3c4dd2..e9123d403 100644 --- a/framework/validators/CRangeValidator.php +++ b/framework/validators/CRangeValidator.php @@ -54,13 +54,13 @@ class CRangeValidator extends CValidator throw new CException(Yii::t('yii','The "range" property must be specified with a list of values.')); $result = false; if($this->strict) - $result = in_array($value,$this->range,true); + $result=in_array($value,$this->range,true); else { foreach($this->range as $r) { - $result = $r === '' || $value === '' ? $r === $value : $r == $value; - if ($result) + $result=(strcmp($r,$value)===0); + if($result) break; } }