Issue Type: Bug Created: 2010-07-16T10:35:52.000+0000 Last Updated: 2010-07-28T00:29:23.000+0000 Status: Resolved Fix version(s): - 1.11.0 (02/Nov/10)
Reporter: marc wren (marcwren) Assignee: Thomas Weidner (thomas) Tags: - Zend_Currency
Related issues: Attachments:
According to the documentation for Zend_Currency: getCurrencyList(): Returns a list of all currencies which are used in the given region as array. Defaults to the objects locale when no region has been given.
Given this description, I would expect the code snippet "$oCurrency = new Zend_Currency(); $aAvailableCurrencies = $oCurrency->getCurrencyList();" to return a list of currencies used in the region specified by the user's browser. However, this code is instead returning the list of all currencies and the regions associated with each currency.
Looking at the Zend_Currency::getCurrencyList() method, either the line "Zend_Locale_Data::getList('', 'regiontocurrency', $region);" is not returning the expected data or additional processing must be done before returning a value.
Posted by Thomas Weidner (thomas) on 2010-07-16T15:17:43.000+0000
You are missing one thing.
To which locale has Zend_Currency been set? This information in not available by the snippet you gave.
It can be the users locale, the environment locale, a registry locale or a locale which is set within the bootstrap.
Additionally, when you've set only a language without a region this method is unable to return proper data because when no region is given, region specific informations can not be retrieved.
The main question which only you can answer is: Which region is requested by Zend_Currency within the subcall.
Posted by marc wren (marcwren) on 2010-07-19T09:04:28.000+0000
I reproduced this issue for the regions US and FR. I tested a few different ways:
Digging a little deeper into the Zend_Locale_Data::getList() method, I'm seeing the following strings generated as the $id value being loaded from cache (line 316 in Zend_Locale_Data for framework version 1.10.6): "Zend_LocaleL_fr_FR_regiontocurrency_FR" (browser set to fr_FR and Zend_Currency initialized to fr_FR) "Zend_LocaleL_fr_FR_regiontocurrency_US" (browser set to fr_FR and Zend_Currency initialized to en_US) "Zend_LocaleL_en_regiontocurrency_US" (browser language not specified and Zend_Currency initialized to en_US) "Zend_LocaleL_en_regiontocurrency_FR" (browser language not specified and Zend_Currency initialized to fr_FR)
However, all of these cache indexes return the exact same array of 167 currency => region pairs. I'm assuming that the expected result from the above cache requests should be an array of currency names associated with the region specified at the end of the cache index string.
I hope that answers your question.
Posted by Thomas Weidner (thomas) on 2010-07-28T00:29:18.000+0000
Fixed with r22708
Have you found an issue?
See the Overview section for more details.