Skip to content

Commit 1ae3438

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
2 parents 7713302 + 1bf2b04 commit 1ae3438

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

ext/intl/tests/bug68471.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #68471 (IntlDateFormatter fails for "GMT+00:00" timezone)
3+
--EXTENSIONS--
4+
intl
5+
--FILE--
6+
<?php
7+
$formatter = new IntlDateFormatter(
8+
'fr_FR',
9+
IntlDateFormatter::NONE,
10+
IntlDateFormatter::NONE,
11+
"GMT+00:00"
12+
);
13+
var_dump($formatter);
14+
?>
15+
--EXPECT--
16+
object(IntlDateFormatter)#1 (0) {
17+
}

ext/intl/timezone/timezone_class.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
175175
return timezone_convert_datetimezone(tzobj->type, tzobj, 0,
176176
outside_error, func);
177177
} else {
178-
UnicodeString id,
179-
gottenId;
178+
UnicodeString id;
180179
UErrorCode status = U_ZERO_ERROR; /* outside_error may be NULL */
181180
if (!try_convert_to_string(zv_timezone)) {
182181
zval_ptr_dtor_str(&local_zv_tz);
@@ -203,7 +202,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone,
203202
zval_ptr_dtor_str(&local_zv_tz);
204203
return NULL;
205204
}
206-
if (timeZone->getID(gottenId) != id) {
205+
if (*timeZone == TimeZone::getUnknown()) {
207206
spprintf(&message, 0, "%s: No such time zone: '%s'",
208207
func, Z_STRVAL_P(zv_timezone));
209208
if (message) {

0 commit comments

Comments
 (0)