Permalink
Browse files

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

  • Loading branch information...
fabpot committed Jul 9, 2012
1 parent 7db877c commit 68f3a10d59ffb101ab9bf65560efdeb61677cef7
Showing with 2 additions and 2 deletions.
  1. +2 −2 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;
}
}

0 comments on commit 68f3a10

Please sign in to comment.