Issues

ZF-11735: Zend_Date toString wrongly interprets first argument format as a locale

Issue Type: Bug Created: 2011-09-12T09:32:56.000+0000 Last Updated: 2012-03-05T22:50:07.000+0000 Status: Open Fix version(s): Reporter: Robin Lindroos (robin.lindroos) Assignee: Thomas Weidner (thomas) Tags: -

Related issues: Attachments:

Description

The code below should print out a date formatted with PHP date formatting rule "MY" where M is a short textual representation of a month, three letters and Y is a full numeric representation of a year, 4 digits.

The problem is that this code example causes an exception: "Missing locale file '/home/robin/hammerkit/hammerkit40/inc/external/Zend/Locale/Data/MY.xml' for 'MY' locale."

It seems that in this case where the string "MY" also is a locale the format argument to the method toString is wrongly interpreted as a locale and not the date formatting rule. The problem seems to be in the file Date.php where the Zend_Date class is defined. On lines 443-445 in this file where the toString method is defined is an if statement with a test "Zend_Locale::isLocale($format, null, false)". Because this returns TRUE for the formatting rule "MY" it then is for some reason interpreted as a locale for the conversions done later in toString, and because of that this results in the exception.

--- Start code example --- Zend_Date::setOptions(array('format_type' => 'php')); $dateObj = new Zend_Date(1315819309, null, 'en_GB'); echo $dateObj->toString('MY'); --- End code example ---

Comments

No comments to display

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