Zend Framework

Zend_Currency toCurrency precision error.

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6.2
  • Fix Version/s: 1.8.0
  • Component/s: Zend_Currency
  • Labels:
    None

Description

Precision error when given a number to method toCurrency()

$zendLocale = new Zend_Locale($config->locale);
Zend_Locale::setDefault('pt_PT');
// define default Zend_Locale_Format
Zend_Locale_Format::setOptions(array(
'locale' => $zendLocale,
'precision' => 2
));

$zendCurrency = new Zend_Currency($zendLocale);
$zendCurrency->toCurrency($price);

if the price is 14.2278 for example it returns 14,22 € (localized number) when actually should return 14,23 €

I managed to correct this using toFloat() on line 173 of Zend/Currency.php file, instead of toNumber().
Is this the right stuff to do?

Issue Links

Activity

Hide
Thomas Weidner added a comment -

Dependent of ZF-3473

Show
Thomas Weidner added a comment - Dependent of ZF-3473
Hide
Thomas Weidner added a comment -

Fixed with r13990

Show
Thomas Weidner added a comment - Fixed with r13990

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: