Skip to content

NumberFormatter::__construct limits usage by throwing an error #18170

@Bgright

Description

@Bgright

Description

When constructing a NumberFormatter like so:

new NumberFormatter('@numbers=roman', NumberFormatter::DECIMAL);

or

new NumberFormatter('@numbers=jpan', NumberFormatter::DECIMAL);

Now an error is thrown which limits the class' functionality. Now you are required to enter a "valid" locale such as en_US etc.

On the PHP website it appears this was introduced in 8.4.0:

8.4.0 A ValueError is thrown if locale is invalid.

As a result I have to downgrade PHP or create my own number formatter class.

PHP Version

PHP 8.5.0

Operating System

Debian

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions