|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66985 Some timezones are no longer valid in PHP 5.5.10
Submitted: 2014-03-30 20:13 UTC Modified: 2015-07-07 21:41 UTC
Avg. Score:4.3 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:3 (100.0%)
From: evert at rooftopsolutions dot nl Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.5.10 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
19 - 12 = ?
Subscribe to this entry?

 [2014-03-30 20:13 UTC] evert at rooftopsolutions dot nl
Sample code attached. Note that this worked before 5.5.10.

Perhaps I took advantage of a feature that was not supposed to be supported, in which case I would definitely appreciate a workaround that works pre and post 5.5.10 :)

Test script:
php -r "echo (new DateTimeZone('EST5EDT'))->getName();";

Expected result:

Actual result:
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (EST5EDT)' in Command line code on line 1

Exception: DateTimeZone::__construct(): Unknown or bad timezone (EST5EDT) in Command line code on line 1

Call Stack:
    0.0001     221064   1. {main}() Command line code:0
    0.0001     221296   2. DateTimeZone->__construct() Command line code:1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-30 22:25 UTC] evert at rooftopsolutions dot nl
Here's a full list of timezones that are not supported on PHP 5.5.10:

 [2014-03-31 10:00 UTC]
-Status: Open +Status: Not a bug
 [2014-03-31 10:00 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

You're right. Those no longer work. But you're also right that you used a "feature" that you shouldn't have. Those names are not "timezones", but rather country names (or weird BC entries). It surprises me that they worked in the first place!
 [2014-03-31 14:57 UTC] evert at rooftopsolutions dot nl
Hey Derick,

They worked, because they are part of the olson file, and they are documented on the php site:

Furthermore, I'm using these, not in my code, but because I'm receiving timezone strings from various sources that I can't control. This one came from a c library (libical) from some system that had it's system timezone likely set to EST5EDT.

While I don't disagree that neither I nor anyone else should be using these, you introduced a BC break in a minor PHP version of a documented feature, without as much as a mention in the changelog.

That, to me, sounds like a bug.
 [2014-07-16 14:03 UTC]
I agree this shouldn't have been changed in a minor version. For better or worse, there is a lot of EST5EDT and other POSIX tz identifiers out there being used interchangeably with Olson identifiers. If Olson lists it, I think we should support it and if we are going to drop some we should add warnings and in the current version and then drop them only in the next major version.
 [2014-07-16 14:26 UTC]
I don't disagree... but not sure what to do now. It's been four patch releases (or more since) and the discontinuation of those "deprecated identifiers" was a consequence of allowing CEST and the like as argument to a constructor - which there were a few bug reports for. So we can't just revert the patch.

Fixing this is certainly possible, but not as trivial as I hoped when looking into this again. It's still in the back of my head, but I've had some other priorities.
 [2014-07-16 14:30 UTC]
-Status: Not a bug +Status: Re-Opened
 [2014-07-16 14:30 UTC]
Yup, I looked at it too, I thought it would be as simple as adding them back into the array there, but I see it isn't. The fact that it has been 4 patch releases isn't really an issue though. People are migrating slowly to 5.5 still. For those who are already on current 5.5 they either already fixed this by moving to a more precise tz identifier or they didn't have the problem in the first place, so they won't be affected by the fix. And for the others who aren't there yet it will only help them by removing a compatibility obstacle.
 [2014-07-16 17:01 UTC] evert at rooftopsolutions dot nl
OT: Bit dissapointed that it required a comment from Rasmus for this issue to be as much as acknowledged. Didn't ask for an immediate fix, but getting ignored really sucks.
 [2014-07-18 15:51 UTC]
Derick, wouldn't the easiest solution just be to add these to timezonemap.h?
As in, for EST5EDT it would be something like:

{ "edt",   1, -14400, "EST5EDT"                       },
{ "est",   1, -18000, "EST5EDT"                       },
 [2014-07-18 16:04 UTC]
It doesn't work, there are some other bits of code that only let allow through IDs with a / in them. I've moved this to the top of my todo list, so hopefully get to it soon.
 [2014-07-19 00:02 UTC]
Note: JST (Japanese Standard Time) is used to work with older PHP also.
 [2014-07-20 00:43 UTC]
Hrm.. In my simple test it worked. It was zone_search() that was failing. With that hack this works fine:

$tz = new DateTimeZone('EST5EDT');
echo $tz->getName()."\n";
$date = new DateTime('2000-01-01', $tz);
$date = $date->modify('+6 months');
echo $date->format('Y-m-d') . "\n";

But true, looking closer at it, $tz->getTranstitions() doesn't return anything.
 [2014-08-17 10:12 UTC]
I have a fix in the works for this. Code works, but need some more test cases and checking for memory leaks.
 [2014-08-17 10:12 UTC]
-Status: Re-Opened +Status: Assigned -Assigned To: +Assigned To: derick
 [2014-08-18 19:28 UTC]
Automatic comment on behalf of
Log: Fixed bug #66985: Some timezones are no longer valid in PHP 5.5.10.
 [2014-08-18 19:28 UTC]
-Status: Assigned +Status: Closed
 [2014-10-15 06:49 UTC] gm dot outside+php at gmail dot com
As the fix went in so a minor bug in the test file (ext/date/tests/bug66985.phpt).  Although the test file name itself properly refers to this bug (66985), the very beginning of the file refers to bug #66986 instead.  I believe it was a trivial typo, but it's a bit confusing, so it would be great if somebody could fix that.
 [2015-07-07 21:41 UTC]
> I believe it was a trivial typo, but it's a bit confusing, so it
> would be great if somebody could fix that.

Thanks for the hint. Fixed now.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 03:01:27 2024 UTC