NumberFormatter has incorrect currency symbols for certain locales

Bug #1636205 reported by Bene Tamás
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
icu (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Won't Fix
Undecided
Unassigned
Yakkety
Fix Released
Undecided
Unassigned
php7.0 (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Invalid
Undecided
Unassigned
Yakkety
Fix Released
Undecided
Unassigned

Bug Description

Intl seems to be missing certain currency symbols in certain locales on ubuntu 16.04.

I noticed while doing some unit tests.
Under hu_HU locale, the expected result was 5 000 Ft
The actual result turned out to be 5 000 HUF.
It seems to be specific to this build, as this passes without problems on the CI server, and also worked fine on other distributions.

Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

Please could you provide a set of minimal steps to reproduce the problem? For example, can you provide some PHP code that doesn't produce your expected result?

Once done, please change the bug status back to New. Thanks!

Changed in php7.0 (Ubuntu):
status: New → Incomplete
Revision history for this message
Bene Tamás (btaens) wrote :

Of course, sorry for the late answer.

The number formatter simply has to be set to the hungarian locale and have the currency set to HUF.

The expected result in this case is: 5 000,00 Ft
The actual result I get is: 5 000,00 HUF

I've come to suspect it is the ICU library this PHP library was built with that is missing the required locale data.

Here's a code example:

<?php
$nf = new \NumberFormatter("hu@currency=HUF", \NumberFormatter::CURRENCY);
echo $nf->format(5000);

Changed in php7.0 (Ubuntu):
status: Incomplete → New
Joshua Powers (powersj)
Changed in php7.0 (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
tags: added: server-next
Revision history for this message
Nish Aravamudan (nacc) wrote :

# cat test.php
<?php
$nf = new \NumberFormatter("hu@currency=HUF", \NumberFormatter::CURRENCY);
echo $nf->format(5000) . PHP_EOL;
?>

17.04 (7.0.15-1ubuntu3):
# php test.php
5 000,00 Ft

16.10 (7.0.15-0ubuntu0.16.10.4):
# php test.php
5 000,00 Ft

16.04 (7.0.15-0ubuntu0.16.04.4):
# php test.php
5 000,00 HUF

So I took a look at 16.04 uses libicu55 while 16.10+ use libicu57. I'm guessing there is an upstream bugfix needed for src:icu.

Changed in icu (Ubuntu):
status: New → Fix Released
Changed in icu (Ubuntu Yakkety):
status: New → Fix Released
Changed in icu (Ubuntu Xenial):
status: New → Triaged
Changed in php7.0 (Ubuntu Xenial):
status: New → Triaged
Changed in php7.0 (Ubuntu):
status: Triaged → Fix Released
Changed in php7.0 (Ubuntu Yakkety):
status: New → Fix Released
Revision history for this message
Nish Aravamudan (nacc) wrote :
Changed in php7.0 (Ubuntu Xenial):
status: Triaged → Invalid
tags: removed: server-next
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Xenial has entered ESM (Extended Support) recently. As such, I am closing its task as Won't Fix.

Changed in icu (Ubuntu Xenial):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.