[php-src] Issue #23964: ResourceBundle::create('nb', null, false) breaks nb formatting for the rest of the process
| From: | tomsommer | Date: | Mon, 28 Sep 2026 12:07:59 +0000 |
| Subject: | [php-src] Issue #23964: ResourceBundle::create('nb', null, false) breaks nb formatting for the rest of the process | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252840@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23964
Author: tomsommer
### Description
The following code:
```php
<?php
ResourceBundle::create('nb', null, false);
echo (new NumberFormatter('nb', NumberFormatter::DECIMAL))->format(200000),
"\n";
echo (new NumberFormatter('nb_NO', NumberFormatter::CURRENCY))->formatCurrency(1234.5,
'NOK'), "\n";
echo (new IntlDateFormatter('nb', IntlDateFormatter::LONG, IntlDateFormatter::NONE,
'UTC'))->format(0), "\n";
```
Resulted in this output:
```
200,000
kr 1,234.50
1970 M01 1
```
But I expected this output instead:
```
200 000
1 234,50 kr
1. januar 1970
```
That's what you get without the
ResourceBundle::create() line, or with
$fallback = true. da isn't affected, so I assume it's because
nb is an alias locale in ICU. Once it has happened, every nb formatter in
the process is broken, so in php-fpm it lasts until the worker is recycled. It only happens if the
bundle is opened before anything else in the process has used nb.
$fallback = false maps to ures_openDirect(), so this may well be ICU
caching a bad entry and not something PHP can fix. Reporting it here first, since from PHP it's
just a call to a documented function.
We ran into it through brick/money, which uses this call to validate locales: https://github.com/brick/money/issues/134
ICU 74.2 (libicu74-74.2-1.el9.remi).
### PHP Version
```
PHP 8.5.11 (cli) (built: Sep 22 2026 13:32:06) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine #NoAI
Zend Engine v4.5.11, Copyright (c) Zend Technologies
with Zend OPcache v8.5.11, Copyright (c), by Zend Technologies
```
### Operating System
AlmaLinux 9.8