Bug #80611 [NEW]: NumberFormatter appears to have broken in PHP 8.x.
| From: | kit dot soul at usweek dot net | Date: | Sat, 09 Jan 2021 21:49:06 +0000 |
| Subject: | Bug #80611 [NEW]: NumberFormatter appears to have broken in PHP 8.x. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-231470@lists.php.net to get a copy of this message | ||
From: kit dot soul at usweek dot net
Operating system: Windows
PHP version: 8.0.1
Package: Output Control
Bug Type: Bug
Bug description:NumberFormatter appears to have broken in PHP 8.x.
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 bug report at https://bugs.php.net/bug.php?id=80611&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80611&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80611&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80611&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80611&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80611&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80611&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80611&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80611&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80611&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80611&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80611&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80611&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80611&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80611&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80611&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80611&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80611&r=mysqlcfg