Issues

ZF-8654: Zend_Validate_Date reports date as valid, when validating incorrect date without separators

Issue Type: Bug Created: 2009-12-29T03:36:48.000+0000 Last Updated: 2012-11-20T21:37:54.000+0000 Status: Open Fix version(s): Reporter: Viktoras P. (viktoras.p) Assignee: None Tags: - Zend_Validate

Related issues: - ZF-7583

Attachments:

Description

When trying to validate user entered date, which has no separators, Zend_Validate_Date reports it as 'Valid', though it's not really a valid one.

Example:

<pre class="highlight">
$objValidator = new Zend_Validate_Date();
echo $objValidator->setFormat('MM-dd-YYYY')->isValid(123) ? 'Valid' : 'Invalid';
echo $objValidator->setFormat('MM-dd-YYYY')->isValid('123123') ? 'Valid' : 'Invalid';
echo $objValidator->setFormat('MM-dd-YYYY')->isValid('12232008') ? 'Valid' : 'Invalid';

Expected: Invalid Invalid Invalid Result: Valid Valid Valid

It seems that Zend_Locale_Format::_parseDate() tries to parse date even if format given doesn't have any separators.

Comments

Posted by Thomas Weidner (thomas) on 2009-12-29T04:40:12.000+0000

Duplicates ZF-7583

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts