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

View File

@@ -137,7 +137,17 @@ class Validator {
*/ */
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;
} }
/** /**