[php-maint] Bug#628079: php5-common: Wrong timezone selected
Stepan Golosunov
stepan at golosunov.pp.ru
Wed Aug 28 13:55:33 UTC 2013
Control: found -1 5.4.4-14+deb7u4
Control: tags -1 - moreinfo
On Fri, May 27, 2011 at 09:05:24AM +1000, Craig Small wrote:
> Package: php5-common
> Version: 5.3.6-11
> Severity: normal
>
> Both the apache module and cli PHP show my timezone as
> Antartica/Macquarie. I'm not a penguin and don't live there.
> The rest of the system thinks my timezone is Australia/NSW which is
> correct.
>
> I cannot find anywhere where it is set as it is commented out in the
> php.ini files. If I set the timezone in my php.ini file then everything
> works correctly, but why can't php just use the system timezone like the
> rest of the computer does ok?
I am seeing similar issue with Europe/Samara being confused with
Asia/Samarkand.
# cat /etc/timezone
Europe/Samara
# php -i|grep -i timezone
"Olson" Timezone Database Version => 0.system
Timezone Database => internal
Default timezone => Asia/Samarkand
date.timezone => no value => no value
# printf '<?php\necho date("c"), "\\n";\n'|php
2013-08-28T17:38:31+05:00
# printf '<?php\necho date("c"), "\\n";\n'|TZ=Europe/Samara php
2013-08-28T17:38:36+05:00
# printf '<?php\necho date("c"), "\\n";\n'|TZ=Europe/Moscow php
2013-08-28T16:38:40+04:00
# date
Wed Aug 28 16:38:55 SAMT 2013
# printf '<?php\necho date("c"), "\\n";\n'|php -d date.timezone=Europe/Samara
2013-08-28T16:39:45+04:00
The last 3 variants show correct time.
After looking into use_embedded_timezonedb.patch I think that
timelib_timezone_id_from_abbr is called with "SAMT" as the first agrument.
And according to tzdata sources "SAMT" was used by Asia/Samarkand in
the past. And it even was UTC+4 before 1930. And php's zone_search
picks the first entry from timezonemap.h:
$ grep '"samt".*1440*' php5-5.4.4/ext/date/lib/timezonemap.h
{ "samt", 0, 14400, "Asia/Samarkand" },
{ "samt", 0, 14400, "Europe/Samara" },
Australia/Sydney has the same problem with "EST": it was used by
Antarctica/Macquarie:
$ grep '"est".*36000*' php5-5.4.4/ext/date/lib/timezonemap.h
{ "est", 0, 36000, "Antarctica/Macquarie" },
{ "est", 0, 36000, "Australia/ACT" },
{ "est", 0, 36000, "Australia/Brisbane" },
{ "est", 0, 36000, "Australia/Canberra" },
{ "est", 0, 36000, "Australia/Currie" },
{ "est", 0, 36000, "Australia/Hobart" },
{ "est", 0, 36000, "Australia/LHI" },
{ "est", 0, 36000, "Australia/Lindeman" },
{ "est", 0, 36000, "Australia/Lord_Howe" },
{ "est", 0, 36000, "Australia/Melbourne" },
{ "est", 0, 36000, "Australia/NSW" },
{ "est", 0, 36000, "Australia/Queensland" },
{ "est", 0, 36000, "Australia/Sydney" },
{ "est", 0, 36000, "Australia/Tasmania" },
{ "est", 0, 36000, "Australia/Victoria" },
More information about the pkg-php-maint
mailing list