diff --git a/library/Zend/Validator/Date.php b/library/Zend/Validator/Date.php index c2b12ca54ed..905d5a63b86 100644 --- a/library/Zend/Validator/Date.php +++ b/library/Zend/Validator/Date.php @@ -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; } diff --git a/tests/ZendTest/Form/View/Helper/FormRowTest.php b/tests/ZendTest/Form/View/Helper/FormRowTest.php index 8c7ae052e98..3b90833a847 100644 --- a/tests/ZendTest/Form/View/Helper/FormRowTest.php +++ b/tests/ZendTest/Form/View/Helper/FormRowTest.php @@ -305,4 +305,18 @@ public function testShowErrorInRadio() $markup = $this->helper->__invoke($element); $this->assertContains('', $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("", $markup))); + } }