php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33415 Possibly invalid non-one-hour DST or timezone shifts
Submitted: 2005-06-21 02:14 UTC Modified: 2005-06-30 04:15 UTC
From: nickj-phpbugs at nickj dot org Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5CVS-2005-06-21 (dev) OS: Debian Woody GNU/Linux 3.0r6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nickj-phpbugs at nickj dot org
New email:
PHP Version: OS:

 

 [2005-06-21 02:14 UTC] nickj-phpbugs at nickj dot org
Description:
------------
[Follow-up on bug 20382, after systematic testing for times returned that are on the days we asked for, but are not midnight or 1 AM, and then eliminating duplicates within a timezone. Note that there can be valid non-one-hour DST transitions (very rare, but they do happen), so there is a very good chance that at least some of these are bogus. However, 17 of the 26 do not appear to involve a DST or timezone transition, so these 17 would appear less likely to be bogus].

==================================================
<?php

print "TZ=America/Jujuy  - Is it OK for this to be 2 AM, rather than 1 AM as per most DST transitions?\n";
putenv("TZ=America/Jujuy");
$tStamp = mktime (17, 17, 17, 1, 7593, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday            00:00:00\n\n";


print "TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to have a DST or timezone transition.\n";
putenv("TZ=Africa/Bujumbura");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday            00:00:00\n\n";


print "TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM?\n";
putenv("TZ=Asia/Thimbu");
$tStamp = mktime (17, 17, 17, 1, 6476, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday            00:00:00\n\n";


print "TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Indian/Cocos");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday            00:00:00\n\n";


print "TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Africa/Lubumbashi");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Saturday            00:00:00\n\n";


print "TZ=Asia/Kashgar - Is it OK for this to be 3 AM?\n";
putenv("TZ=Asia/Kashgar");
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday            00:00:00\n\n";


print "TZ=Indian/Christmas - Is it OK for this to be 7 AM?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Indian/Christmas");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday            00:00:00\n\n";


print "TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM?\n";
putenv("TZ=America/Santo_Domingo");
$tStamp = mktime (17, 17, 17, 1, 291, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday            00:00:00\n\n";


print "TZ=Pacific/Truk - Is it OK for this to be 10 AM?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Pacific/Truk");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday            00:00:00\n\n";


print "TZ=Pacific/Ponape - Is it OK for this to be 11 AM?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Pacific/Ponape");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday            00:00:00\n\n";


print "TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?\n";
putenv("TZ=Asia/Tbilisi");
$tStamp = mktime (17, 17, 17, 1, 12863, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday            00:00:00\n\n";


print "TZ=America/Scoresbysund - Is it OK for this to be 2 AM?\n";
putenv("TZ=America/Scoresbysund");
$tStamp = mktime (17, 17, 17, 1, 4099, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday            00:00:00\n\n";


print "TZ=America/Guyana - Is it OK for this to be 0:45 AM?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=America/Guyana");
$tStamp = mktime (17, 17, 17, 1, 2031, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday            00:00:00\n\n";


print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Asia/Tehran");
$tStamp = mktime (17, 17, 17, 1, 2855, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday            00:00:00\n\n";


print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does not appear to have a DST or timezone transition.\n";     
putenv("TZ=Pacific/Tarawa");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday            00:00:00\n\n";


print "TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? (Strange time).\n";
putenv("TZ=Africa/Monrovia");
$tStamp = mktime (17, 17, 17, 1, 845, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday            00:00:00\n\n";


print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?.\n";
putenv("TZ=Asia/Katmandu");
$tStamp = mktime (17, 17, 17, 1, 5838, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday            00:00:00\n\n";         


print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? No DST or timezone transition.\n";
putenv("TZ=Pacific/Nauru");
$tStamp = mktime (17, 17, 17, 1, 3401, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday            00:00:00\n\n";           


print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? No DST or timezone transition.\n";
putenv("TZ=Pacific/Niue");
$tStamp = mktime (17, 17, 17, 1, 3189, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday            00:00:00\n\n";            


print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST or timezone transition.\n";
putenv("TZ=Pacific/Port_Moresby");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);   
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Thursday", $tStamp); 
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday            00:00:00\n\n";          


print "TZ=America/Miquelon - Is it OK for this to be 2 AM ?\n";
putenv("TZ=America/Miquelon");
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday            00:00:00\n\n";


print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or timezone transition.\n";
putenv("TZ=Pacific/Palau");   
$tStamp = mktime (17, 17, 17, 1, 1, 1970);   
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Saturday            00:00:00\n\n";


print "TZ=Pacific/Funafuti - Is it OK for this to be midday?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Pacific/Funafuti");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday            00:00:00\n\n";


print "TZ=Pacific/Wake - Is it OK for this to be midday?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Pacific/Wake");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday            00:00:00\n\n";


print "TZ=Pacific/Wallis - Is it OK for this to be midday?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=Pacific/Wallis");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday            00:00:00\n\n";


print "TZ=America/Paramaribo - Is it OK for this to be 0:30 AM?  Note: does not appear to have a DST or timezone transition.\n";
putenv("TZ=America/Paramaribo");
$tStamp = mktime (17, 17, 17, 1, 5381, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday            00:00:00\n\n";

?>
==================================================

Output on my Debian 3.0r6 Linux system, versus expected output:

==================================================
ludo:~/tmp/php-5.1-dev/php5-200506201830/sapi/cli# ./php ~/test/possibly-invalid-non-one-hour-DST-timezone-shifts.php 
TZ=America/Jujuy  - Is it OK for this to be 2 AM, rather than 1 AM as per most DST transitions?
tStamp=Monday 1990-10-15 17:17:17 ART 0
result=Monday 1990-10-22 02:00:00 ARST 1
wanted=Monday            00:00:00

TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 CAT 0
result=Wednesday 1970-01-07 02:00:00 CAT 0
wanted=Wednesday            00:00:00

TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM?
tStamp=Thursday 1987-09-24 17:17:17 IST 0
result=Thursday 1987-10-01 00:30:00 BTT 0
wanted=Thursday            00:00:00

TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 CCT 0
result=Thursday 1970-01-08 06:30:00 CCT 0
wanted=Thursday            00:00:00

TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 CAT 0
result=Saturday 1970-01-03 02:00:00 CAT 0
wanted=Saturday            00:00:00

TZ=Asia/Kashgar - Is it OK for this to be 3 AM?
tStamp=Thursday 1980-04-24 17:17:17 KAST 0
result=Thursday 1980-05-01 03:00:00 CST 0
wanted=Thursday            00:00:00

TZ=Indian/Christmas - Is it OK for this to be 7 AM?  Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 CXT 0
result=Sunday 1970-01-04 07:00:00 CXT 0
wanted=Sunday            00:00:00

TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM?
tStamp=Sunday 1970-10-18 17:17:17 EST 0
result=Sunday 1970-10-25 00:30:00 EHDT 1
wanted=Sunday            00:00:00

TZ=Pacific/Truk - Is it OK for this to be 10 AM?  Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 TRUT 0
result=Tuesday 1970-01-06 10:00:00 TRUT 0
wanted=Tuesday            00:00:00

TZ=Pacific/Ponape - Is it OK for this to be 11 AM?  Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 PONT 0
result=Monday 1970-01-05 11:00:00 PONT 0
wanted=Monday            00:00:00

TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?
tStamp=Sunday 2005-03-20 17:17:17 GET 0
result=Sunday 2005-03-27 02:00:00 GEST 1
wanted=Sunday            00:00:00

TZ=America/Scoresbysund - Is it OK for this to be 2 AM?
tStamp=Sunday 1981-03-22 17:17:17 CGT 0
result=Sunday 1981-03-29 02:00:00 EGST 1
wanted=Sunday            00:00:00

TZ=America/Guyana - Is it OK for this to be 0:45 AM?  Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1975-07-24 17:17:17 GYT 0
result=Thursday 1975-07-31 00:45:00 GYT 0
wanted=Thursday            00:00:00

TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? Note: does not appear to have a DST or timezone transition.
tStamp=Tuesday 1977-10-25 17:17:17 IRT 0
result=Tuesday 1977-11-01 00:30:00 IRT 0
wanted=Tuesday            00:00:00

TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 GILT 0
result=Monday 1970-01-05 12:00:00 GILT 0
wanted=Monday            00:00:00

TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? (Strange time).
tStamp=Monday 1972-04-24 17:17:17 LRT 0
result=Monday 1972-05-01 00:44:30 GMT 0
wanted=Monday            00:00:00

TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?.
tStamp=Wednesday 1985-12-25 17:17:17 IST 0
result=Wednesday 1986-01-01 00:15:00 NPT 0
wanted=Wednesday            00:00:00

TZ=Pacific/Nauru - Is it OK for this to be 0:30? No DST or timezone transition.
tStamp=Tuesday 1979-04-24 17:17:17 NRT 0
result=Tuesday 1979-05-01 00:30:00 NRT 0
wanted=Tuesday            00:00:00

TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? No DST or timezone transition.
tStamp=Sunday 1978-09-24 17:17:17 NUT 0
result=Sunday 1978-10-01 00:30:00 NUT 0
wanted=Sunday            00:00:00

TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 PGT 0
result=Thursday 1970-01-08 10:00:00 PGT 0
wanted=Thursday            00:00:00

TZ=America/Miquelon - Is it OK for this to be 2 AM ?
tStamp=Thursday 1980-04-24 17:17:17 AST 0
result=Thursday 1980-05-01 02:00:00 PMDT 1
wanted=Thursday            00:00:00

TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 PWT 0
result=Saturday 1970-01-03 09:00:00 PWT 0
wanted=Saturday            00:00:00

TZ=Pacific/Funafuti - Is it OK for this to be midday?  Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 TVT 0
result=Wednesday 1970-01-07 12:00:00 TVT 0
wanted=Wednesday            00:00:00

TZ=Pacific/Wake - Is it OK for this to be midday?  Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 WAKT 0
result=Tuesday 1970-01-06 12:00:00 WAKT 0
wanted=Tuesday            00:00:00

TZ=Pacific/Wallis - Is it OK for this to be midday?  Note: does not appear to have a DST or timezone transition.
tStamp=Thursday 1970-01-01 17:17:17 WFT 0
result=Tuesday 1970-01-06 12:00:00 WFT 0
wanted=Tuesday            00:00:00

TZ=America/Paramaribo - Is it OK for this to be 0:30 AM?  Note: does not appear to have a DST or timezone transition.
tStamp=Monday 1984-09-24 17:17:17 SRT 0
result=Monday 1984-10-01 00:30:00 SRT 0
wanted=Monday            00:00:00

ludo:~/tmp/php-5.1-dev/php5-200506201830/sapi/cli# 
==================================================



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-28 23:51 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2005-06-30 04:15 UTC] nickj-phpbugs at nickj dot org
Confirmed fixed on php5-200506300030 ("fixed" = the times now either fall on midnight, or look like plausible time shifts)

This also fixes four of the timezones listed in bug #33414 for me, namely:
* TZ=Pacific/Johnston 
* TZ=Pacific/Fakaofo
* TZ=Pacific/Kwajalein
* TZ=Atlantic/South_Georgia 

Thank you!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC