Commit b9f9b165 by Qiang Xue

Apply fix for #1003 to validateAttribute.

parent adcf7888
......@@ -56,7 +56,8 @@ class DateValidator extends Validator
return;
}
$date = DateTime::createFromFormat($this->format, $value);
if ($date === false) {
$errors = DateTime::getLastErrors();
if ($date === false || $errors['error_count'] || $errors['warning_count']) {
$this->addError($object, $attribute, $this->message);
} elseif ($this->timestampAttribute !== null) {
$object->{$this->timestampAttribute} = $date->getTimestamp();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment