Bug->Req #73988 [Opn->Wfx]: zone offset not recognized by timezone_name_from_abbr
| From: | derick@php.net | Date: | Tue, 24 Jan 2017 17:46:09 +0000 |
| Subject: | Bug->Req #73988 [Opn->Wfx]: zone offset not recognized by timezone_name_from_abbr | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206924@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73988&edit=1
ID: 73988
Updated by: derick@php.net
Reported by: cca dot alexk at gmail dot com
Summary: zone offset not recognized by
timezone_name_from_abbr
-Status: Open
+Status: Wont fix
-Type: Bug
+Type: Feature/Change Request
Package: Date/time related
Operating System: MacOS/Linux
PHP Version: 7.0.15
Block user comment: N
Private report: N
New Comment:
Guessing the timezone identifier from just an abbreviation + UTCoffset + DSTenabled, is a tricky
thing to do at first, as a combination is not unique.
It is even trickier to do with *just* UTCoffset + DSTenabled.
The fallback map was only really implemented to keep function parity with old PHP versions. At the
time when it was written, there was no timezone that used UTC+6 (without DST), and hence, it does
not have an entry. Right now for example, there could be several equally correct pickings:
derick@whisky:~ $ for i in /usr/share/zoneinfo/Asia/*; do zdump -v $i -c 2013,2018 |grep
"isdst=0 gmtoff=21600"; done
/usr/share/zoneinfo/Asia/Barnaul Sat Oct 25 19:00:00 2014 UT = Sun Oct 26 01:00:00 2014 +06 isdst=0
gmtoff=21600
/usr/share/zoneinfo/Asia/Barnaul Sat Mar 26 19:59:59 2016 UT = Sun Mar 27 01:59:59 2016 +06 isdst=0
gmtoff=21600
/usr/share/zoneinfo/Asia/Novosibirsk Sat Oct 25 19:00:00 2014 UT = Sun Oct 26 01:00:00 2014 NOVT
isdst=0 gmtoff=21600
/usr/share/zoneinfo/Asia/Omsk Sat Oct 25 19:00:00 2014 UT = Sun Oct 26 01:00:00 2014 OMST isdst=0
gmtoff=21600
/usr/share/zoneinfo/Asia/Tomsk Sat Oct 25 19:00:00 2014 UT = Sun Oct 26 01:00:00 2014 +06 isdst=0
gmtoff=21600
/usr/share/zoneinfo/Asia/Tomsk Sat May 28 19:59:59 2016 UT = Sun May 29 01:59:59 2016 +06 isdst=0
gmtoff=21600
/usr/share/zoneinfo/Asia/Yekaterinburg Sat Oct 25 19:59:59 2014 UT = Sun Oct 26 01:59:59 2014 YEKT
isdst=0 gmtoff=21600
I am reluctant to add more entries to this fallback map, and even if we would add it, I think it
should be added as:
{ "novt", 0, 360, "Asia/Novosibirsk" },
To fit in with:
{ "novst", 1, 420, "Asia/Novosibirsk" },
{ "krat", 0, 420, "Asia/Krasnoyarsk" },
{ "krast", 1, 480, "Asia/Krasnoyarsk" },
Because of the non-uniqueness, I am not in favour in adding more entries.
Previous Comments:
------------------------------------------------------------------------
[2017-01-24 17:24:17] cca dot alexk at gmail dot com
Description:
------------
timezone_name_from_abbr return false on valid time offset.
For example: Asia/Omsk has GMT+6(MSK+3) timezone, but function return false.
Test script:
---------------
var_dump( timezone_name_from_abbr("", 6*3600, false) );
Expected result:
----------------
Timezone string "Asia/Omsk"
Actual result:
--------------
false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73988&edit=1