|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-01-24 17:24 UTC] 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
Patchestimezone_name_from_abbr_omsk (last revision 2017-01-24 17:25 UTC by cca dot alexk at gmail dot com)Pull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
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.