[Docker] [PHP] NumberFormatter :: FormatCurrency在7.4.29和7.4.28之间不兼容
(与 https://github.com/docker.com/docker-library-library/php/php/1301/1301/1301 )
运行以下脚本的结果在 php之间是不同的:7.4.29-fpm-alpine
和 php:7.4.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(我希望)
在-
php:7.4.4.29-fpm-alpine 在
(我的)问题
是否有任何方法可以在 php:7.4.4.29-fpm-alpine
中获得结果,以成为他们在 php:7.4 .28-fpm-alpine
? (有能力解决吗?)
重现的方法
参见 https://github.com /sogaoh/reproduce-compatible-format-currency (readme.md)
备注
之间也存在类似的问题
- (未经证实)我猜想8.0.19和8.0.18
- 8.1.6和8.1.6和8.1.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
两者之间的区别在于,.28版本使用
\ uffe5
'FullWidth YEN符号,并且.29版本使用\ u00a5
'YEN SIGN。正如Github发行评论中指出的那样,与图像,高山或PHP本身的问题相对,可能会改变基础ICU库之间的基础ICU库。作为临时修复程序,您可以使用安装固定版本ICU的修改图像,但YMMV。
另外,您也可以在简单的替代品中使用:
尽管问题本身是相当化妆的,而IMO的原始用法是货币符号的全宽字形是更可疑的选择。
The difference between the two is that the .28 version uses
\uffe5
'Fullwidth Yen Sign, and the .29 version uses\u00a5
'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:
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.
我的解决方案:
安装 package:icu-data-fulll 其他。
refs
My solution:
Install package: icu-data-full additionally.
refs