ZF-6560: Zend_Currency::toCurrency(): precision bug with positive values

Issue Type: Bug Created: 2009-05-06T08:54:04.000+0000 Last Updated: 2009-05-16T07:34:48.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Dennis Becker (radhad) Assignee: Thomas Weidner (thomas) Tags: - Zend_Currency

  • Zend_Locale

Related issues: - ZF-6655



I have a small test for checking the new behaviour of Zend_Currency with Zend_Locale_Format. There is a bug in Zend_Locale_Format::toNumber(). Here is a small snippet to test the bug:

(I cannot write euro sign, so I use EUR instead!

<pre class="highlight">
require_once 'Zend/Currency.php';
$currency = new Zend_Currency(null, 'de_DE');

Zend_Debug::dump($currency->toCurrency(74.95, array('currency' => 'EUR', 'precision' => 2))); // returns 74,95 EUR
Zend_Debug::dump($currency->toCurrency(74.95, array('currency' => 'EUR', 'precision' => 3))); // returns 74,950EUR
Zend_Debug::dump($currency->toCurrency(74.95, array('currency' => 'EUR', 'precision' => 4))); // returns 74,9500 // No euro sign !
Zend_Debug::dump($currency->toCurrency(74.95, array('currency' => 'EUR', 'precision' => 4))); // returns 74,95000 // No euro sign

I have found out that on line 444, Zend/Locale/Format.php will return (bool)false instead of an integer value with precision higher than 3. When this happens, the euro sign lefts (or its placeholder in $format).

This results in teh bug, that there is a missing space between the value and the euro sign. In ZF 1.7.7, the method Zend_Locale_Format::toNumber() is different at this point.


Posted by Thomas Weidner (thomas) on 2009-05-16T07:31:59.000+0000

Fixed with r15607

Have you found an issue?

See the Overview section for more details.


© 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.