Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/2633'
Browse files Browse the repository at this point in the history
Close #2633
  • Loading branch information
weierophinney committed Oct 3, 2012
2 parents 7d49e8e + 43866c8 commit 0474ef5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Validator/Date.php
Expand Up @@ -128,7 +128,7 @@ public function isValid($value)
// and still return a DateTime object
$errors = DateTime::getLastErrors();

if (false === $date || $errors['warning_count'] > 0) {
if ($errors['warning_count'] > 0) {
$this->error(self::INVALID_DATE);
return false;
}
Expand Down
14 changes: 14 additions & 0 deletions tests/ZendTest/Form/View/Helper/FormRowTest.php
Expand Up @@ -305,4 +305,18 @@ public function testShowErrorInRadio()
$markup = $this->helper->__invoke($element);
$this->assertContains('<ul><li>Error message</li></ul>', $markup);
}

public function testErrorShowTwice()
{
$element = new Element\Date('birth');
$element->setFormat('Y-m-d');
$element->setValue('2010-13-13');

$validator = new \Zend\Validator\Date();
$validator->isValid($element->getValue());
$element->setMessages($validator->getMessages());

$markup = $this->helper->__invoke($element);
$this->assertEquals(2, count(explode("<ul><li>The input does not appear to be a valid date</li></ul>", $markup)));
}
}

0 comments on commit 0474ef5

Please sign in to comment.