From: richard dot gunn at deckard dot worldonline dot co dot uk
Operating system: Linux (Ubuntu 8.04)
PHP version: 5.2.6
PHP Bug Type: Unknown/Other Function
Bug description: function money_format() : space missing from currency symbols
Description:
------------
I noticed that the money_format() function appears to work in an
inconsistent manner depending on the locale.
(Compare the expected output with the actual output)
I would expect GBP, CAD and AUD to be formatted the same as USD - i.e. a
space between the currency symbol and the numeric.
It's a minor issue with an easy workaround, but I'd thought I'd "do the
right thing" and raise a bug report.
Reproduce code:
---------------
$number = 100000.698 ;
$arrCountry = array ('GB', 'US', 'CA', 'AU') ;
foreach ($arrCountry as $currCountry) {
$locale = 'en_' . $currCountry . '.UTF-8';
setlocale (LC_MONETARY, $locale);
$locale_info = localeconv();
$currency = $locale_info['int_curr_symbol'];
$amount = money_format('%i', $number);
printf ("%s [%s] %s \n",$locale, $currency, $amount);
}
Expected result:
----------------
en_GB.UTF-8 [GBP ] GBP 100,000.70
en_US.UTF-8 [USD ] USD 100,000.70
en_CA.UTF-8 [CAD ] CAD 100,000.70
en_AU.UTF-8 [AUD ] AUD 100,000.70
Actual result:
--------------
en_GB.UTF-8 [GBP ] GBP100,000.70
en_US.UTF-8 [USD ] USD 100,000.70
en_CA.UTF-8 [CAD ] CAD100,000.70
en_AU.UTF-8 [AUD ] AUD100,000.70
--
Edit bug report at http://bugs.php.net/?id=45165&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45165&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45165&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45165&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45165&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45165&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45165&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45165&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45165&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45165&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45165&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45165&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45165&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45165&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45165&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45165&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45165&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45165&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45165&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45165&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45165&r=mysqlcfg