[php-src] Issue #12931: setlocale does not recognize installed locale da_DK.UTF-8
| From: | clarkk | Date: | Mon, 11 Dec 2023 13:53:33 +0000 |
| Subject: | [php-src] Issue #12931: setlocale does not recognize installed locale da_DK.UTF-8 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246033@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12931
Author: clarkk
### Description
After upgrading from Debian 11 + PHP8.1 to Debian 12 + PHP8.2
setlocale() does not
recognize da_DK.UTF-8 even if it is installed (see the bottom)
Or the code works on command line php file.php but it does not work on FPM+nginx
The following code:
```
$loc = 'da_DK.UTF-8';
$l = setlocale(LC_MONETARY, $loc);
var_dump($l);
$locconv = localeconv();
print_r($locconv);
```
Resulted in this output (FPM+nginx):
```
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] =>
[currency_symbol] =>
[mon_decimal_point] =>
[mon_thousands_sep] =>
[positive_sign] =>
[negative_sign] =>
[int_frac_digits] => 127
[frac_digits] => 127
[p_cs_precedes] => 127
[p_sep_by_space] => 127
[n_cs_precedes] => 127
[n_sep_by_space] => 127
[p_sign_posn] => 127
[n_sign_posn] => 127
[grouping] => Array
(
)
[mon_grouping] => Array
(
)
)
```
Resulted in this output command line php file.php and this is also the expected result:
```
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] => DKK
[currency_symbol] => kr.
[mon_decimal_point] => ,
[mon_thousands_sep] => .
[positive_sign] =>
[negative_sign] => -
[int_frac_digits] => 2
[frac_digits] => 2
[p_cs_precedes] => 1
[p_sep_by_space] => 2
[n_cs_precedes] => 1
[n_sep_by_space] => 2
[p_sign_posn] => 4
[n_sign_posn] => 4
[grouping] => Array
(
)
[mon_grouping] => Array
(
[0] => 3
[1] => 3
)
)
```
```
# locale -a
C
C.utf8
da_DK.utf8
en_US.utf8
POSIX
# php -v
PHP 8.2.13 (cli) (built: Nov 24 2023 13:10:42) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.13, Copyright (c) Zend Technologies
with Zend OPcache v8.2.13, Copyright (c), by Zend Technologies
```
The locales are installed via dpkg-reconfigure locales and I only install two locales
```
da_DK.utf8
en_US.utf8
```
### PHP Version
PHP 8.2.13
### Operating System
Debian 12