Skip to content

Commit 5455c3f

Browse files
committed
Merge branch 'PHP-8.3'
2 parents ec8e86b + f20edf0 commit 5455c3f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

ext/intl/dateformat/dateformat_create.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ 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) {
116-
zend_argument_value_error(1, "\"%s\" is invalid", locale_str);
115+
if (locale.isBogus() || ((locale_len == 1 && locale_str[0] != 'C') && strlen(locale.getISO3Language()) == 0)) {
116+
zend_argument_value_error(1, "\"%s\" is invalid", locale_str);
117117
return FAILURE;
118118
}
119119

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)