[php-src] Issue #12282: IntlDateFormatter returns incorrect week number for an invalid locale (and doesn't throw an exception either)

From: Date: Sat, 23 Sep 2023 10:14:01 +0000
Subject: [php-src] Issue #12282: IntlDateFormatter returns incorrect week number for an invalid locale (and doesn't throw an exception either)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245421@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12282 Author: campbell-m ### Description The following code: ```php <?php $date = DateTimeImmutable::createFromFormat('Y-m-d', '2023-09-23', new DateTimeZone('Europe/London')); foreach (['en', 'xx'] as $locale) { $formatter = new IntlDateFormatter( $locale, IntlDateFormatter::FULL, IntlDateFormatter::FULL, null, null, 'w' ); echo "Locale: $locale, Week number: " . $formatter->format($date) . "<br>\n"; } ``` Resulted in this output: ``` Locale: en, Week number: 38 Locale: xx, Week number: 39 ``` But I expected this output instead: ``` Locale: en, Week number: 38 Locale: xx, Week number: 38 ``` or else for an exception to be thrown when trying to use 'xx'. This problem happens on all versions of PHP and all operating systems I have tested. ### PHP Version PHP 8.3.0RC2 ### Operating System Windows NT 10.0 build 22621 (Windows 11) AMD64

« previous php.bugs (#245421) next »