fix bug in validator class required check.

This commit is contained in:
Taylor Otwell 2011-07-21 22:00:23 -05:00
parent 49cd851f54
commit e9a43326a7
1 changed files with 11 additions and 1 deletions

View File

@ -137,7 +137,17 @@ protected function check($attribute, $rule)
*/ */
protected function validate_required($attribute) protected function validate_required($attribute)
{ {
return array_key_exists($attribute, $this->attributes) and trim($this->attributes[$attribute]) !== ''; if ( ! array_key_exists($attribute, $this->attributes))
{
return false;
}
if (is_string($this->attributes[$attribute]) and trim($this->attributes[$attribute]) === '')
{
return false;
}
return true;
} }
/** /**