Код: Выделить всё
public function rules()
{
return array(
array('username, password, verifyCode', 'required'),
array('username, password, verifyCode', 'type', 'type' => 'string'),
array('username, password, verifyCode', 'length', 'max' => 255),
array('rememberMe', 'boolean'),
array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest),
);
}
Код: Выделить всё
/**
* Validates the attribute of the object.
* If there is any error, the error message is added to the object.
* @param CModel $object the object being validated
* @param string $attribute the attribute being validated
*/
protected function validateAttribute($object,$attribute)
{
$value=$object->$attribute;
if($this->allowEmpty && $this->isEmpty($value))
return;
if($this->type==='integer')
$valid=preg_match('/^[-+]?[0-9]+$/',trim($value));
else if($this->type==='float')
$valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
else if($this->type==='date')
$valid=CDateTimeParser::parse($value,$this->dateFormat,array('month'=>1,'day'=>1,'hour'=>0,'minute'=>0,'second'=>0))!==false;
else if($this->type==='time')
$valid=CDateTimeParser::parse($value,$this->timeFormat)!==false;
else if($this->type==='datetime')
$valid=CDateTimeParser::parse($value,$this->datetimeFormat, array('month'=>1,'day'=>1,'hour'=>0,'minute'=>0,'second'=>0))!==false;
else if($this->type==='array')
$valid=is_array($value);
else
return;
if(!$valid)
{
$message=$this->message!==null?$this->message : Yii::t('yii','{attribute} must be {type}.');
$this->addError($object,$attribute,$message,array('{type}'=>$this->type));
}
}
2012/02/24 22:47:01 [error] [php] mb_strlen() expects parameter 1 to be string, array given (/usr/home/admin/sites/*****.com/yii-1.1.10.r3566/framework/validators/CStringValidator.php:85)
Глупейшее недопущение по-моему.