|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68471 \IntlDateFormatter considers "GMT+00:00" an invalid timezone
Submitted: 2014-11-21 12:59 UTC Modified: 2021-06-23 15:28 UTC
Avg. Score:4.0 ± 1.4
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: mathieu dot louafi at gmail dot com Assigned: cmb (profile)
Status: Closed Package: intl (PECL)
PHP Version: 5.6.3 OS: Ubuntu 13.10
Private report: No CVE-ID: None
 [2014-11-21 12:59 UTC] mathieu dot louafi at gmail dot com
The \IntlDateFormatter constructor returns 'null' when provided a 'GMT+00:00' timezone.
The correct bevahior would be to return an instance of \IntlDateFormatter.

My guess is that the problem lies in intl-3.0.0/timezone/timezone_class.cpp at line 202-211:

if (timeZone->getID(gottenId) != id) {

    return NULL;

The problem is that, in the specific case of 'GMT+00:00', the 'timeZone->getID(gottenId)' evaluates to 'GMT', thus the inequality is sastified.

(in PHP: IntlTimeZone::createTimeZone('GMT+0N:00')->getID() is 'GMT+0N:00' if N is not 0, and 'GMT' if N = 0)

Test script:
$dt = [new \DateTime('2015-01-01 00:00:00 +00:00'), new \DateTime('2015-01-01 00:00:00 +01:00')];
$tz = ['GMT+00:00', 'GMT+01:00'];

foreach (array_merge($dt, $tz) as $timezone) {
    if ($timezone instanceof \DateTime) {
        $timezone = $timezone->getTimeZone();

    $formatter = new \IntlDateFormatter(

    if (is_null($formatter)) {

Expected result:
Nothing, as the $formatter should never be 'null'.

Actual result:
object(DateTimeZone)#3 (2) {
  string(6) "+00:00"

string(9) "GMT+00:00"


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-21 13:17 UTC] mathieu dot louafi at gmail dot com
Commenting the lines 202-211 in intl-3.0.0/timezone/timezone_class.cpp and re-compiling the extension lead to the following behaviors of the \IntlDateFormatter constructor:

- 'GMT+00:00' is considered a valid timezone (the constructor returns an \IntlDateFormatter instance as expected)

- (new \DateTime('2015-01-01 00:00:00 +00:00'))−>getTimeZone() is still considered an invalid timezone (the constructor returns 'null')

This partially confirms my first guess about these lines of code.
 [2021-06-23 15:28 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-06-23 15:28 UTC]
I agree that it doesn't make sense to reject the timezone when
passed to IntlDateFormatter::__construct(), but to allow it for
 [2021-06-23 16:25 UTC]
The following pull request has been associated:

Patch Name: Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
On GitHub:
 [2021-06-28 11:58 UTC]
Automatic comment on behalf of cmb69
Log: Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
 [2021-06-28 11:58 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 17 20:03:37 2021 UTC