php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64703 NumberFormatter getPattern() returns incorrect currency pattern
Submitted: 2013-04-24 10:24 UTC Modified: 2013-04-24 15:29 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: andy at websitevision dot co dot uk Assigned:
Status: Not a bug Package: intl (PECL)
PHP Version: Irrelevant OS: Windows 7
Private report: No CVE-ID: None
 [2013-04-24 10:24 UTC] andy at websitevision dot co dot uk
Description:
------------
Using PHP 5.4.3 with php_intl extension loaded...

NumberFormatter->getPattern returns an incorrect pattern for currencies where the locale is somewhere that uses commas as the decimal. NumberFormatter->formatCurrency correctly places the dot and the comma, but the pattern returned by getPattern has these the wrong way round (see Test script).



Test script:
---------------
$fmt = new NumberFormatter('es', NumberFormatter::CURRENCY);
echo $fmt->getPattern();
echo "<br>";
echo $fmt->formatCurrency(9999.99, 'EUR');

// displays as:
// ¤ #,##0.00
// € 9.999,99

Expected result:
----------------
#.##0,00
€ 9.999,99

Actual result:
--------------
#,##0.00
€ 9.999,99

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-24 15:29 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2013-04-24 15:29 UTC] ab@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The format looks correct. Please consult the ICU API docs http://icu-project.org/apiref/icu4c/classicu_1_1DecimalFormat.html
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Mar 31 00:01:25 2020 UTC