Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.9.2
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Currency
-
Labels:None
-
Tags:
Description
I always use an instance of Zend_Currency to display prices etc. Now I ran into a bug after upgrading from 1.7.8 to 1.9.2 - the toCurrency method ignores the currency value in the option array. Here is a small test I used:
$value = '';
$currencyObject = new Zend_Currency('de_DE');
$value = $currencyObject->toCurrency(2.3, array('currency' => 'USD', 'precision' => 4));
Zend_Debug::dump($value); // prints "2,3000 €" - expected "2,3000 $"
$value = '';
$currencyObject = new Zend_Currency('USD', 'de_DE');
$value = $currencyObject->toCurrency(2.3, array('precision' => 4));
Zend_Debug::dump($value); // prints "2,3000 $" as expected
The first example is often used, because I cannot know which currency should be used for the customer - so setting the currency while converting is a must have for me. If I see it right, the bug depends on getSymbol() which results in an error if no locale is given. I will add a patch which corrects the problem for me.
I will add additionally a Unit-Test patch ( I read the "Bughunt day" notification today) so that it does not need to be double-researched. This will take some minutes I think
Just wait until I have uploaded it.