Some timezones are no longer valid in PHP 5.5.10
| 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 |
|
||||||||||
| 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 | |||||||||||
[2014-03-30 20:13 UTC] evert at rooftopsolutions dot nl
Description:
------------
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:
----------------
EST5EDT
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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2014-03-30 22:25 UTC] evert at rooftopsolutions dot nl
[2014-03-31 10:00 UTC] derick@php.net
[2014-03-31 14:57 UTC] evert at rooftopsolutions dot nl
[2014-07-16 14:03 UTC] rasmus@php.net
[2014-07-16 14:26 UTC] derick@php.net
[2014-07-16 14:30 UTC] rasmus@php.net
-Status: Not a bug +Status: Re-Opened
[2014-07-16 14:30 UTC] rasmus@php.net
[2014-07-16 17:01 UTC] evert at rooftopsolutions dot nl
[2014-07-18 15:51 UTC] rasmus@php.net
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] derick@php.net
[2014-07-19 00:02 UTC] yohgaki@php.net
[2014-07-20 00:43 UTC] rasmus@php.net
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] derick@php.net
[2014-08-17 10:12 UTC] derick@php.net
-Status: Re-Opened +Status: Assigned -Assigned To: +Assigned To: derick
[2014-08-18 19:28 UTC] derick@php.net
-Status: Assigned +Status: Closed
[2014-10-15 06:49 UTC] gm dot outside+php at gmail dot com
[2015-07-07 21:41 UTC] cmb@php.net