Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 8d52861c8772d5185b3030ef96457674925bef21 1 parent afe30c7
@vesln vesln authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 util/Validator.php
View
6 util/Validator.php
@@ -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;
- }
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.