Bug #51557 [Opn]: timelib_timezone_lookup has invalid DST entries, breaks strtotime

[email protected] ("a3297627 at owlpic dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at http://bugs.php.net/bug.php?id=51557&edit=1

 ID:               51557
 User updated by:  a3297627 at owlpic dot com
 Reported by:      a3297627 at owlpic dot com
 Summary:          timelib_timezone_lookup has invalid DST entries,
                   breaks strtotime
 Status:           Open
 Type:             Bug
 Package:          Date/time related
 Operating System: Linux
 PHP Version:      5.2.13

 New Comment:

Copy/paste error, the test output should read:

Expected result:

Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 05:00:00 +0000
Converted: Thursday, Apr 15 12:00am EDT
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 12:00am EDT

Actual Result:
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 05:00:00 +0000
Converted: Thursday, Apr 15 1:00am EDT
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 12:00am EDT


Previous Comments:
------------------------------------------------------------------------
[2010-04-15 06:17:07] a3297627 at owlpic dot com

Description:
------------
It seems timezonemap.h was generated by a tzdata parser that
unfortunately did not include information on the years Daylight Saving
Time was in use. In particular, in South Korea, there is no DST, yet
there exists KST/KDT distinction in strtotime that thinks KDT is
currently active, with inconsistencies with other date/time functions.

Test script:
---------------
<?php
function tzconvert ($input, $timezone)
{
        $ts = strtotime ($input);
        $time = gmdate ('r', $ts);
        $dt = new DateTime ($time);
        $dt->setTimeZone (new DateTimeZone ($timezone));
        echo "Input: $time\nConverted: " . $dt->format ('l, M d g:ia T')
. "\n";
}

tzconvert ("Thursday, April 15 2010 12:00am EDT", "KST");
tzconvert ("Thursday, April 15 2010 12:00am EDT", "KDT");

tzconvert ("Thursday, Apr 15 1:00pm KST", "EDT");
tzconvert ("Thursday, Apr 15 1:00pm KDT", "EDT");
?>


Expected result:
----------------
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 05:00:00 +0000
Converted: Thursday, Apr 15 1:00am EDT
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 12:00am EDT


Actual result:
--------------
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00pm KST
Input: Thu, 15 Apr 2010 05:00:00 +0000
Converted: Thursday, Apr 15 1:00am EDT
Input: Thu, 15 Apr 2010 04:00:00 +0000
Converted: Thursday, Apr 15 1:00am EDT



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51557&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.