Edit report at https://bugs.php.net/bug.php?id=51557&edit=1
ID: 51557
Comment by: kavi at postpro dot net
Reported by: a3297627 at owlpic dot com
Summary: timelib_timezone_lookup has invalid DST entries,
breaks strtotime
Status: Assigned
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.2.13
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
Is this actually a dupe of https://bugs.php.net/bug.php?id=62130 ???
Anyway, I updated the test a bit for 2012 (the original didn't include the year
in the second pair of tzconvert calls) and put the date in June to very clearly
avoid DST boundaries.
<?
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("Tuesday, June 15 2010 12:00am EDT", "KST");
tzconvert("Tuesday, June 15 2010 12:00am EDT", "KDT");
tzconvert("Tuesday, June 15 2010 1:00pm KST", "EDT");
tzconvert("Tuesday, June 15 2010 1:00pm KDT", "EDT");
<?
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("Tuesday, June 15 2010 12:00am EDT", "KST");
tzconvert("Tuesday, June 15 2010 12:00am EDT", "KDT");
tzconvert("Tuesday, June 15 2010 1:00pm KST", "EDT");
tzconvert("Tuesday, June 15 2010 1:00pm KDT", "EDT");
Input: Tue, 15 Jun 2010 04:00:00 +0000
Converted: Tuesday, Jun 15 1:00pm KST
Input: Tue, 15 Jun 2010 04:00:00 +0000
Converted: Tuesday, Jun 15 1:00pm KST
Input: Tue, 15 Jun 2010 05:00:00 +0000
Converted: Tuesday, Jun 15 1:00am EDT
Input: Tue, 15 Jun 2010 04:00:00 +0000
Converted: Tuesday, Jun 15 12:00am EDT
The actual problem really seems like bug #62130, but with an argument provided
to the DateTime constructor as a DateTimeZone, not in the time string itself.
Previous Comments:
------------------------------------------------------------------------
[2010-04-15 06:19:30] a3297627 at owlpic dot com
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
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=51557&edit=1