Skip to content

Commit 1bf2b04

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

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PHP NEWS
1313
- Intl:
1414
. Fixed bug #72809 (Locale::lookup() wrong result with canonicalize option).
1515
(cmb)
16+
. Fixed bug #68471 (IntlDateFormatter fails for "GMT+00:00" timezone). (cmb)
1617

1718
- PCRE:
1819
. Fixed bug #81101 (PCRE2 10.37 shows unexpected result). (Anatol)

ext/intl/tests/bug68471.phpt

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

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)