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


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?


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


which means that numbers are rendered like


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)