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

Issue Type: Bug Created: 2009-08-06T08:57:23.000+0000 Last Updated: 2009-08-08T09:53:03.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Zoran Lazic (zoki) Assignee: Thomas Weidner (thomas) Tags: - Zend_Currency

Related issues: Attachments:


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.

<pre class="literal">
$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?


Posted by Thomas Weidner (thomas) on 2009-08-08T09:52:34.000+0000

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

<pre class="highlight">

which means that numbers are rendered like

<pre class="highlight">

You changed to name which then returns

<pre class="highlight">
US Dollar1,234.00

Then you changed the position which returns

<pre class="highlight">
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)

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.