php-src/ext/intl/tests/bug68471.phpt
Christoph M. Becker 1a01f7816c
Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
GMT+00:00 is recognized by ICU, and is normalized to GMT.  There are no
issues when GMT+00:00 is passed to `IntlTimeZone::createTimeZone()`,
but passing it to IntlDateFormatter::__construct() causes a failure,
since there is an additional check regarding the validity.  While
checking the validity of the result of `TimeZone::createTimeZone()`[1]
is a good idea, comparing the IDs is overly restrictive.  Instead we
just check that the timezone is supported by ICU.

[1] <https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/classicu_1_1TimeZone.html#a35da0507b62754ffe5d8d59c19775cdb>

Closes GH-7190.
2021-06-28 13:54:22 +02:00

20 lines
377 B
PHP

--TEST--
Bug #68471 (IntlDateFormatter fails for "GMT+00:00" timezone)
--SKIPIF--
<?php
if (!extension_loaded('intl')) die("sikp intl extension not available");
?>
--FILE--
<?php
$formatter = new IntlDateFormatter(
'fr_FR',
IntlDateFormatter::NONE,
IntlDateFormatter::NONE,
"GMT+00:00"
);
var_dump($formatter);
?>
--EXPECT--
object(IntlDateFormatter)#1 (0) {
}