Permalink
Browse files

Fixing the case when last is used on empty value with required option

  • Loading branch information...
1 parent afe30c7 commit 8d52861c8772d5185b3030ef96457674925bef21 @vesln vesln committed Aug 7, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 util/Validator.php
View
@@ -454,17 +454,21 @@ public static function check(array $values, array $rules, array $options = array
if ($rule['required']) {
$errors[$field][] = $rule['message'] ?: $key;
}
+ if ($rule['last']) {
+ break;
+ }
continue;
}
if (empty($values[$field]) && $rule['skipEmpty']) {
continue;
}
+
if (!static::rule($name, $values[$field], $rule['format'], $rule + $options)) {
$errors[$field][] = $rule['message'] ?: $key;
if ($rule['last']) {
break;
- }
+ }
}
}
}

0 comments on commit 8d52861

Please sign in to comment.