Bug #80611 [Fbk->NoF]: NumberFormatter appears to have broken in PHP 8.x.
| From: | php-bugs at lists dot php dot net | Date: | Sun, 18 Jul 2021 04:22:24 +0000 |
| Subject: | Bug #80611 [Fbk->NoF]: NumberFormatter appears to have broken in PHP 8.x. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235131@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80611&edit=1
ID: 80611
Updated by: php-bugs@lists.php.net
Reported by: kit dot soul at usweek dot net
Summary: NumberFormatter appears to have broken in PHP 8.x.
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Output Control
Operating System: Windows
PHP Version: 8.0.1
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-07-06 16:20:45] cmb@php.net
Have you considered to report that upstream[1]?
[1] <http://site.icu-project.org/bugs>
------------------------------------------------------------------------
[2021-01-11 18:44:45] cmb@php.net
That is apparently an upstream issue; when building PHP 8.0 with
ICU 66.1 everything works as expected, but with ICU 67.1 the issue
is reproducible. It is not particularly related to BTC (that
currency is only supported as of ICU 68.1), but also reproduces
with EUR, for instance. It is also not related to an empty string
as currency symbol, but shows with '$' as well.
------------------------------------------------------------------------
[2021-01-09 21:49:06] kit dot soul at usweek dot net
Description:
------------
NumberFormatter's formatCurrency() function no longer respects an empty currency symbol.
Output of test script in PHP 7.4.13 (Windows):
string(6) "0.0043"
Output of test script in PHP 8.0.1 (Windows):
string(11) "BTC 0.0043"
Conclusion: Something has changed.
I cannot find any mention whatsoever of PHP 8 here: https://www.php.net/manual/en/numberformatter.formatcurrency.php
I asked it here but nobody can even reproduce it (possibly because they don't use Windows?): https://stackoverflow.com/questions/65636460/how-to-resolve-this-new-bug-change-in-behaviour-in-php-8-x-in-regards-to-numberf
Test script:
---------------
$a = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY);
$a->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, 8);
$a->setSymbol(NumberFormatter::CURRENCY_SYMBOL, ''); // It's empty because I want
it "minimal" for a table cell.
var_dump($a->formatCurrency(0.0043, 'BTC'));
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80611&edit=1