From 3a2215b833a5dd911973aee1997da5489dfa88a0 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 3 Aug 2013 01:19:26 +0400 Subject: [PATCH] fixed length constraints check to always result in correct range --- framework/yii/web/CaptchaAction.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/yii/web/CaptchaAction.php b/framework/yii/web/CaptchaAction.php index 98599d9..fef44fd 100644 --- a/framework/yii/web/CaptchaAction.php +++ b/framework/yii/web/CaptchaAction.php @@ -189,15 +189,15 @@ class CaptchaAction extends Action */ protected function generateVerifyCode() { + if ($this->minLength > $this->maxLength) { + $this->maxLength = $this->minLength; + } if ($this->minLength < 3) { $this->minLength = 3; } if ($this->maxLength > 20) { $this->maxLength = 20; } - if ($this->minLength > $this->maxLength) { - $this->maxLength = $this->minLength; - } $length = mt_rand($this->minLength, $this->maxLength); $letters = 'bcdfghjklmnpqrstvwxyz';