(Same as https://github.com/docker-library/php/issues/1301 )
The results of running the following script were different between php:7.4.29-fpm-alpine
and php:7.4.28-fpm-alpine
.
<?php
$fmt = new \NumberFormatter('JA_JP', \NumberFormatter::CURRENCY);
$formatString = $fmt->formatCurrency(0, 'JPY');
var_dump($formatString);
php:7.4.28-fpm-alpine (I expects)
string(4) "¥0"
php:7.4.29-fpm-alpine
string(3) "¥0"
Is there any way to get the results in php:7.4.29-fpm-alpine
to be what they were in php:7.4.28-fpm-alpine
? (Is there a workaround?)
see https://github.com/sogaoh/reproduce-incompatibility-of-format-currency (README.md)
( unconfirmed ) I'm guessing that there is a similar problem between
The difference between the two is that the.28 version uses ¥
'Fullwidth Yen Sign, and the.29 version uses ¥
'Yen Sign.
As noted in the github issue comment, it's likely a change in the underlying ICU library between builds of the image, as opposed to an issue in the image, Alpine, or PHP themselves. As an interim fix you could use a modified image that installs a pinned version of ICU, but YMMV.
Alternatively you could shim in a simple replacement like:
str_replace("\xc2\xa5", "\xef\xbf\xa5", $formatter_output);
Though the issue itself is fairly cosmetic, and IMO the original use of a fullwidth glyph for the currency symbol was the more questionable option.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.