php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44622 Australia/Victoria timezone is wrong this week
Submitted: 2008-04-02 23:58 UTC Modified: 2008-04-03 01:02 UTC
From: mikel at mikelward dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mikel at mikelward dot com
New email:
PHP Version: OS:

 

 [2008-04-02 23:58 UTC] mikel at mikelward dot com
Description:
------------
On PHP 5.1.6 and 5.2.4, strftime is returning the wrong information on my Linux systems in the Australia/Melbourne timezone.

We recently had a change to the rules for daylight savings which extended daylight savings by one week from Sunday 30 March to Sunday 6 April.

The operating system has handled this change fine (using tzdata 2007k), but PHP is wrongly reporting the timezone as UTC+10 instead of UTC+11.

I have seen PHP default to Australia/Melbourne and Australia/ACT on various systems, but all of those will be at UTC+11 until this weekend.  The only timezone that is correctly UTC+10 is Australia/Brisbane.

Calling date_default_timezone_set('Australia/Melbourne') does not solve the problem.

The attached code produces the following output:
PHP time: 3 Apr 2008 9:48
shell time: 3 Apr 2008 10:48 

It shows that the system's time and timezone is correct, but PHP is doing something whacky.  Does it have its own tzdata?  (And if so why?)

Reproduce code:
---------------
<?php

date_default_timezone_set('Australia/Melbourne');

$user_datetime_format = "%e %b %Y %k:%M";

$now = time();
$current_time = strftime($user_datetime_format, $now);
$offset = strftime("%z", $now);
print("PHP time: $current_time\n<br>");
print("shell time: ");
system("date \"+$user_datetime_format\"");

?>



Expected result:
----------------
PHP time: 3 Apr 2008 10:48
shell time: 3 Apr 2008 10:48 

Actual result:
--------------
PHP time: 3 Apr 2008 9:48
shell time: 3 Apr 2008 10:48 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-03 00:31 UTC] mikel at mikelward dot com
Apparently PHP does include its own time zone database.

5.2.5 includes "2007.9".  What version of tzdata (if any) does this correspond to?

Vendors will need to issue errata packages for PHP to address every timezone change.  Certainly there's none for CentOS.

I will build my own 5.2.5 and see how it goes.
 [2008-04-03 01:02 UTC] mikel at mikelward dot com
Fixed by running "pecl upgrade timezonedb" and adding extension=timezonedb.so to php.ini.

I guess you're going to call this not a bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC