Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Validator] fixed error message for dates like 2012-02-31 (closes #4223)

  • Loading branch information...
commit 68f3a10d59ffb101ab9bf65560efdeb61677cef7 1 parent 7db877c
@fabpot fabpot authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 Constraints/DateValidator.php
View
4 Constraints/DateValidator.php
@@ -48,12 +48,12 @@ public function isValid($value, Constraint $constraint)
$value = (string) $value;
- if (!preg_match(static::PATTERN, $value, $matches)) {
+ if (!preg_match(static::PATTERN, $value, $matches) || !checkdate($matches[2], $matches[3], $matches[1])) {
$this->setMessage($constraint->message, array('{{ value }}' => $value));
return false;
}
- return checkdate($matches[2], $matches[3], $matches[1]);
+ return true;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.