Validation Bug

Hii,

I found a bug during validation, I want to report about this.

I have used JMultiSelect and EchMultiSelect in my form. And for validation of form I m using AjaxValidation. So when I was filling this form, I got console error for all multiSelect elements.

i

There is a file in location \\YII\yii\framework\validators\CStringValidator.php. In CStringValidator.php file in line no 85 following code is used

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

In case if $value comes as array value then it throws an error…

So, I added code simply for check array type values and error solved.

I used this code:

if(function_exists(‘mb_strlen’) && $this->encoding!==false && $value!=’’)

	{


		if(is_array($value))


		{


			$length=mb_strlen($value[(count($value)-1)], $this->encoding ? $this->encoding : Yii::app()->charset);


		}else


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


	}

instead of this code:

if(function_exists(‘mb_strlen’) && $this->encoding!==false)

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

:)

This same problem is in /framework/yiilite.php file in line no 9322