Skip to content

\IntlDateFormatter constructor throws an exception for unknown locales since 8.1.25Β #12561

Closed
@mpdude

Description

@mpdude

Description

Since PHP 8.1.25 and due to the changes in #12282, the following code throws an IntlException:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions