Skip to content

Commit a39e869

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
2 parents 9096ba9 + 0da1356 commit a39e869

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ PHP NEWS
2424
. Fixed bug GH-12232 (FPM: segfault dynamically loading extension without
2525
opcache). (Jakub Zelenka)
2626

27+
- Intl:
28+
. Removed the BC break on IntlDateFormatter::construct which threw an
29+
exception with an invalid locale. (David Carlier)
30+
2731
- Opcache:
2832
. Added warning when JIT cannot be enabled. (danog)
2933
. Fixed bug GH-8143 (Crashes in zend_accel_inheritance_cache_find since

ext/intl/dateformat/dateformat_create.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handlin
113113
locale = Locale::createFromName(locale_str);
114114
/* get*Name accessors being set does not preclude being bogus */
115115
if (locale.isBogus() || strlen(locale.getISO3Language()) == 0) {
116-
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: invalid locale", 0);
117-
return FAILURE;
116+
goto error;
118117
}
119118

120119
/* process calendar */

ext/intl/tests/gh12282.phpt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ intl
55
--FILE--
66
<?php
77

8-
try {
9-
new IntlDateFormatter(
8+
var_dump(new IntlDateFormatter(
109
'xx',
1110
IntlDateFormatter::FULL,
1211
IntlDateFormatter::FULL,
1312
null,
1413
null,
1514
'w'
16-
);
17-
} catch (\IntlException $e) {
18-
echo $e->getMessage();
19-
}
15+
));
16+
Locale::setDefault('xx');
17+
var_dump(new IntlDateFormatter(Locale::getDefault()));
2018
--EXPECT--
21-
datefmt_create: invalid locale: U_ILLEGAL_ARGUMENT_ERROR
19+
object(IntlDateFormatter)#1 (0) {
20+
}
21+
object(IntlDateFormatter)#1 (0) {
22+
}

0 commit comments

Comments
 (0)