Zend Framework

Zend_Currency::toCurrency() - no space between number and Currency (PHP version affected)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.9.0
  • Component/s: Zend_Currency
  • Labels:
    None

Description

I don't know if this is gonna get "fixed" - since I think it might PHP version related, but maybe it gets decided that it will get some workaround.

$currency = new Zend_Currency('en_US');
$currency->setFormat(array('display' => Zend_Currency::USE_NAME,
    'position' => Zend_Currency::RIGHT));

// prints '1.000,00 US Dollar'
echo $currency->toCurrency(1000);

On PHP 5.2.4 (ZF 1.8.2) it prints "1.000,00 US Dollar".

On PHP 5.2.6 (ZF 1.8.2 & 1.9.0) it prints "1.000,00US Dollar"

The space between number and currency is missing.
Now all I can see from it is someway PHP version related - or i missed something on the system level.

Can anyone else confirm this?

Activity

Hide
Thomas Weidner added a comment -

The formatting for currency values within en_US in CLDR 1.7 (which is used in 1.9) are:

¤#,##0.00

which means that numbers are rendered like

$1,234.00

You changed to name which then returns

US Dollar1,234.00

Then you changed the position which returns

1,234.00US Dollar

As result to this issue:
According to the above mentioned rules the returned value is correct NOT to hold an space.
Note that old releases can have bugs.

I get the last mentioned result regardless of the used PHP version (5.2.4, 5.2.6, 5.3.0)

Show
Thomas Weidner added a comment - The formatting for currency values within en_US in CLDR 1.7 (which is used in 1.9) are:
¤#,##0.00
which means that numbers are rendered like
$1,234.00
You changed to name which then returns
US Dollar1,234.00
Then you changed the position which returns
1,234.00US Dollar
As result to this issue: According to the above mentioned rules the returned value is correct NOT to hold an space. Note that old releases can have bugs. I get the last mentioned result regardless of the used PHP version (5.2.4, 5.2.6, 5.3.0)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: