ZF-10090: Zend_Locale_Format::checkDateFormat() incorrect handles dates with zero parts
Description
Zend_Locale_Format::checkDateFormat() incorrect handles dates with zero parts.
h3. Steps to reproduce
$filter = new Zend_Filter_LocalizedToNormalized(array('date_format' => 'M/d/yy h:mm a'));
var_dump($filter->filter('06/23/10 12:00 AM'));
returns:
but should return array:
array(7) { ["date_format"]=> string(13) "M/d/yy h:mm a" ["locale"]=> string(2) "en" ["month"]=> string(2) "06" ["day"]=> string(2) "23" ["year"]=> int(2010) ["hour"]=> int(0) ["minute"]=> string(2) "00" }````
h3. Cause of Issue
Zend_Locale_Format on line 1160 has such comparison: {{$date['hour'] == "",}} but {{(int)0 == (string)"".}}
h3. Suggested solution
Cast to string before comparison.
Comments
Posted by Vadim Kusakin (vadim.kusakin) on 2010-07-01T07:08:14.000+0000
It's patch for trunk.
Posted by Thomas Weidner (thomas) on 2010-07-11T11:31:25.000+0000
Patch not accepted. It breaks functionality and fails several unittests.
Posted by Thomas Weidner (thomas) on 2010-07-12T10:36:04.000+0000
Fixed with r22552