Помогите решить проблему с CStringValidator.php(72)

При валидации выдает ошибку:

mb_strlen() expects parameter 1 to be string, array given.

php/framework/validators/CStringValidator.php(72)


 protected function validateAttribute($object,$attribute)

66     {

67         $value=$object->$attribute;

68         if($this->allowEmpty && $this->isEmpty($value))

69             return;

70 

71         if(function_exists('mb_strlen') && $this->encoding!==false)

72             $length=mb_strlen($value, $this->encoding ? $this->encoding : Yii::app()->charset);

73         else

74             $length=strlen($value);

75 

76         if($this->min!==null && $length<$this->min)

77         {

78             $message=$this->tooShort!==null?$this->tooShort:Yii::t('yii','{attribute} is too short (minimum is {min} characters).');

79             $this->addError($object,$attribute,$message,array('{min}'=>$this->min));

80         }

81         if($this->max!==null && $length>$this->max)

82         {

83             $message=$this->tooLong!==null?$this->tooLong:Yii::t('yii','{attribute} is too long (maximum is {max} characters).');

84             $this->addError($object,$attribute,$message,array('{max}'=>$this->max));

controllers/ProductController.php(68): CModel->validate()


{

64             $model->attributes=$_POST['Product'];

65             $ProductValue->attributes=$_POST['ProductValue'];

66             $newPhoto->attributes=$_POST['Photo'];

67             $ProductValue->pr_id=0;

68             if($model->validate()&&$ProductValue->validate()&&$newPhoto->validate()) {

69                 $newPhoto->file = CUploadedFile::getInstance($newPhoto,'file');

70                 if ($newPhoto->file) {

71                     $newPhoto->setDefault();

72                     $newPhoto->title = $model->name;

73                     if ($newPhoto->save()) {

Перепробовал все решения ни чего не помогает, в php.ini прописано mbstring.func_overload "7"

mbstring.internal_encoding "UTF-8". В main прописана кодировка utf-8, база тоже в utf-8, но ошибка не исчезает. Версия yii-1.1.8.r3324. Помогите найти решение.

У вас $model-><имя вашего строгового значения> массив, а должен быть строкой. Проблема в этом.

Спасибо, действительно. Проблема решилась.