ZF-10090: Zend_Locale_Format::checkDateFormat() incorrect handles dates with zero parts

Issue Type: Bug Created: 2010-07-01T07:05:18.000+0000 Last Updated: 2010-07-12T10:36:11.000+0000 Status: Resolved Fix version(s): - 1.10.7 (28/Jul/10)

Reporter: Vadim Kusakin (vadim.kusakin) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments: - ZF-10090.patch


Zend_Locale_Format::checkDateFormat() incorrect handles dates with zero parts.

h3. Steps to reproduce

<pre class="literal">$filter = new Zend_Filter_LocalizedToNormalized(array('date_format' => 'M/d/yy h:mm a'));
var_dump($filter->filter('06/23/10 12:00 AM'));


<pre class="literal">

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.


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

Have you found an issue?

See the Overview section for more details.


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

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