[php-src] Issue #12561: `\IntlDateFormatter` constructor throws an exception for unknown locales since 8.1.25
| From: | mpdude | Date: | Mon, 30 Oct 2023 09:48:53 +0000 |
| Subject: | [php-src] Issue #12561: `\IntlDateFormatter` constructor throws an exception for unknown locales since 8.1.25 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245679@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12561
Author: mpdude
### Description
Since PHP 8.1.25 and due to the changes in #12282, the following code now throws an
IntlException:
```php
<?php
new IntlDateFormatter(
'xx',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
null,
null,
'w'
);
```
There may be many reasons why the locale value is invalid – it might be taken from
the LANG environment variable and be set to C, it might be parsed from
request parameters (the reason behind #12533), or it might be a locale name that is valid on one
system but is not in the list of generated/supported locales on another system.
While I agree that ideally, all these conditions should be checked and caught beforehand, and I also
agree that fixing #12282 without a sensible locale to assume might be difficult, my point is that
turning this condition into an exception in a bugfix release is a breaking change that should be
reverted.
### PHP Version
PHP 8.1.25
### Operating System
_No response_