Search code examples
phpinternationalizationdocker-registryicu

[Docker][PHP] NumberFormatter::formatCurrency incompatible between 7.4.29 and 7.4.28


(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);

Result

  • php:7.4.28-fpm-alpine (I expects)

    string(4) "¥0"
    
  • php:7.4.29-fpm-alpine

    string(3) "¥0"
    

(My) problem

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?)

Way to reproduce

see https://github.com/sogaoh/reproduce-incompatibility-of-format-currency (README.md)

Remarks

( unconfirmed ) I'm guessing that there is a similar problem between

  • 8.0.19 and 8.0.18
  • 8.1.6 and 8.1.5

Solution

  • My solution:

    Install package: icu-data-full additionally.

    refs