Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.10.6
-
Fix Version/s: 1.10.7
-
Component/s: Zend_Locale
-
Labels:None
Description
Zend_Locale_Format::checkDateFormat() incorrect handles dates with zero parts.
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:
string(17) "06/23/10 12:00 AM"
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"
}
Cause of Issue
Zend_Locale_Format on line 1160 has such comparison: {{$date['hour'] == "",}} but (int)0 == (string)"".
Suggested solution
Cast to string before comparison.
It's patch for trunk.