Skip to content

Commit f20edf0

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
2 parents b1206ea + 6a447e7 commit f20edf0

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ PHP NEWS
2626
(Jakub Zelenka)
2727
. Fixed bug GH-12905 (FFI::new interacts badly with observers). (nielsdos)
2828

29+
- Intl:
30+
. Fixed GH-12943 (IntlDateFormatter::__construct accepts 'C' as valid locale).
31+
(David Carlier)
32+
2933
- Hash:
3034
. Fixed bug GH-12936 (hash() function hangs endlessly if using sha512 on
3135
strings >= 4GiB). (nielsdos)

ext/intl/dateformat/dateformat_create.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handlin
112112
}
113113
locale = Locale::createFromName(locale_str);
114114
/* get*Name accessors being set does not preclude being bogus */
115-
if (locale.isBogus() || strlen(locale.getISO3Language()) == 0) {
115+
if (locale.isBogus() || ((locale_len == 1 && locale_str[0] != 'C') && strlen(locale.getISO3Language()) == 0)) {
116116
goto error;
117117
}
118118

ext/intl/tests/gh12943.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
GitHub #12943 IntlDateFormatter::locale accepting "C".
3+
--EXTENSIONS--
4+
intl
5+
--FILE--
6+
<?php
7+
8+
$fmt = new IntlDateFormatter(
9+
'C',
10+
IntlDateFormatter::FULL,
11+
IntlDateFormatter::FULL,
12+
);
13+
var_dump($fmt->getLocale(ULOC_VALID_LOCALE));
14+
--EXPECTF--
15+
string(%d) "%s"

0 commit comments

Comments
 (0)