php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33414 Comprehensive list of incorrect days returned after strtotime() / date() tests
Submitted: 2005-06-21 02:01 UTC Modified: 2005-10-10 03:52 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: nickj-phpbugs at nickj dot org Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5CVS-2005-06-22 (dev) OS: Debian Woody GNU/Linux 3.0r6
Private report: No CVE-ID: None
 [2005-06-21 02:01 UTC] nickj-phpbugs at nickj dot org
Description:
------------
[Follow-up on bug 20382, after systematic testing for days returned that are not the days we asked for, and then eliminating duplicates within a timezone].

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

print "TZ=America/Mendoza - wrong day.\n";
putenv("TZ=America/Mendoza");
$tStamp = mktime (17, 17, 17, 1, 8327, 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/Catamarca - wrong day.\n";
putenv("TZ=America/Catamarca");
$tStamp = mktime (17, 17, 17, 1, 7599, 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/Cordoba - wrong day.\n";
putenv("TZ=America/Cordoba");
$tStamp = mktime (17, 17, 17, 1, 7599, 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/Rosario - wrong day.\n";
putenv("TZ=America/Rosario");
$tStamp = mktime (17, 17, 17, 1, 7958, 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=Europe/Vienna - wrong day - giving unexpected results, at least on my system :-)\n";
putenv("TZ=Europe/Vienna");
$tStamp = mktime (17, 17, 17, 1, 3746, 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/Baku - wrong day.\n";
putenv("TZ=Asia/Baku");
$tStamp = mktime (17, 17, 17, 1, 8299, 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/Noronha - wrong day.\n";
putenv("TZ=America/Noronha");
$tStamp = mktime (17, 17, 17, 1, 10866, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday              00:00:00\n\n";


print "TZ=Pacific/Rarotonga - wrong day.\n";
putenv("TZ=Pacific/Rarotonga");
$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/Havana - wrong day.\n";
putenv("TZ=America/Havana");
$tStamp = mktime (17, 17, 17, 1, 12720, 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=Europe/Tallinn - wrong day.\n";
putenv("TZ=Europe/Tallinn");   
$tStamp = mktime (17, 17, 17, 1, 11777, 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=Atlantic/South_Georgia - wrong day.\n";
putenv("TZ=Atlantic/South_Georgia");
$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/Port-au-Prince - wrong day.\n";
putenv("TZ=America/Port-au-Prince");
$tStamp = mktime (17, 17, 17, 1, 12871, 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/Jerusalem - wrong day.\n";     
putenv("TZ=Asia/Jerusalem");
$tStamp = mktime (17, 17, 17, 1, 13056, 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/Enderbury - wrong day, off by 2 days.\n";
putenv("TZ=Pacific/Enderbury");
$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=Pacific/Kiritimati - wrong day, off by 2 days.\n";
putenv("TZ=Pacific/Kiritimati");
$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=Europe/Vilnius - wrong day.\n";
putenv("TZ=Europe/Vilnius");
$tStamp = mktime (17, 17, 17, 1, 12140, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday            00:00:00\n\n";


print "TZ=Pacific/Kwajalein - wrong day.\n";
putenv("TZ=Pacific/Kwajalein");
$tStamp = mktime (17, 17, 17, 1, 8626, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday            00:00:00\n\n";


print "TZ=Asia/Ulan_Bator - wrong day.\n";
putenv("TZ=Asia/Ulan_Bator");
$tStamp = mktime (17, 17, 17, 1, 11588, 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=America/Cancun - wrong day.\n";
putenv("TZ=America/Cancun");
$tStamp = mktime (17, 17, 17, 1, 11785, 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/Mexico_City - wrong day.\n";
putenv("TZ=America/Mexico_City");
$tStamp = mktime (17, 17, 17, 1, 11781, 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=America/Mazatlan - wrong day.\n";
putenv("TZ=America/Mazatlan");
$tStamp = mktime (17, 17, 17, 1, 11780, 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/Chihuahua - wrong day.\n";
putenv("TZ=America/Chihuahua");
$tStamp = mktime (17, 17, 17, 1, 11782, 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/Kuala_Lumpur - wrong day.\n";     
putenv("TZ=Asia/Kuala_Lumpur");
$tStamp = mktime (17, 17, 17, 1, 4380, 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=America/Managua - wrong day.\n";     
putenv("TZ=America/Managua");
$tStamp = mktime (17, 17, 17, 1, 12879, 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/Chatham - wrong day.\n";       
putenv("TZ=Pacific/Chatham");  
$tStamp = mktime (17, 17, 17, 1, 1762, 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=America/Lima - wrong day.\n";        
putenv("TZ=America/Lima");   
$tStamp = mktime (17, 17, 17, 1, 5839, 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/Karachi - wrong day.\n";
putenv("TZ=Asia/Karachi");
$tStamp = mktime (17, 17, 17, 1, 11783, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday            00:00:00\n\n";


print "TZ=Pacific/Pitcairn - wrong day.\n";
putenv("TZ=Pacific/Pitcairn");
$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=America/Asuncion - wrong day.\n";
putenv("TZ=America/Asuncion");
$tStamp = mktime (17, 17, 17, 1, 11746, 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/Singapore - wrong day.\n";
putenv("TZ=Asia/Singapore");
$tStamp = mktime (17, 17, 17, 1, 4383, 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/Fakaofo - wrong day.\n";
putenv("TZ=Pacific/Fakaofo");
$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=America/Montevideo - wrong day.\n";
putenv("TZ=America/Montevideo");
$tStamp = mktime (17, 17, 17, 1, 12678, 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/Johnston - wrong day.\n";
putenv("TZ=Pacific/Johnston");
$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("Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday              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/wrong-days.php 
TZ=America/Mendoza - wrong day.
tStamp=Sunday 1992-10-18 17:17:17 ART 0
result=Saturday 1992-10-24 23:00:00 ART 0
wanted=Sunday              00:00:00

TZ=America/Catamarca - wrong day.
tStamp=Sunday 1990-10-21 17:17:17 ART 0
result=Saturday 1990-10-27 23:00:00 ART 0
wanted=Sunday              00:00:00

TZ=America/Cordoba - wrong day.
tStamp=Sunday 1990-10-21 17:17:17 ART 0
result=Saturday 1990-10-27 23:00:00 ART 0
wanted=Sunday              00:00:00

TZ=America/Rosario - wrong day.
tStamp=Tuesday 1991-10-15 17:17:17 ART 0
result=Monday 1991-10-21 23:00:00 ART 0
wanted=Tuesday           00:00:00

TZ=Europe/Vienna - wrong day - giving unexpected results, at least on my system :-)
tStamp=Thursday 1980-04-03 17:17:17 CET 0
result=Wednesday 1980-04-09 23:00:00 CET 0
wanted=Thursday             00:00:00

TZ=Asia/Baku - wrong day.
tStamp=Sunday 1992-09-20 17:17:17 AZST 1
result=Saturday 1992-09-26 23:00:00 AZT 0
wanted=Sunday              00:00:00

TZ=America/Noronha - wrong day.
tStamp=Friday 1999-10-01 17:17:17 FNT 0
result=Thursday 1999-10-07 23:00:00 FNT 0
wanted=Friday              00:00:00

TZ=Pacific/Rarotonga - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 CKT 0
result=Monday 1970-01-05 23:30:00 CKT 0
wanted=Tuesday           00:00:00

TZ=America/Havana - wrong day.
tStamp=Thursday 2004-10-28 17:17:17 CDT 1
result=Wednesday 2004-11-03 23:00:00 CST 0
wanted=Thursday             00:00:00

TZ=Europe/Tallinn - wrong day.
tStamp=Saturday 2002-03-30 17:17:17 EET 0
result=Friday 2002-04-05 23:00:00 EET 0
wanted=Saturday          00:00:00

TZ=Atlantic/South_Georgia - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 GST 0
result=Monday 1970-01-05 22:00:00 GST 0
wanted=Tuesday           00:00:00

TZ=America/Port-au-Prince - wrong day.
tStamp=Monday 2005-03-28 17:17:17 EST 0
result=Sunday 2005-04-03 23:00:00 EST 0
wanted=Monday            00:00:00

TZ=Asia/Jerusalem - wrong day.
tStamp=Thursday 2005-09-29 17:17:17 IDT 1
result=Wednesday 2005-10-05 23:00:00 IST 0
wanted=Thursday             00:00:00

TZ=Pacific/Enderbury - wrong day, off by 2 days.
tStamp=Thursday 1970-01-01 17:17:17 PHOT 0
result=Saturday 1970-01-03 23:00:00 PHOT 0
wanted=Monday              00:00:00

TZ=Pacific/Kiritimati - wrong day, off by 2 days.
tStamp=Thursday 1970-01-01 17:17:17 LINT 0
result=Saturday 1970-01-03 23:20:00 LINT 0
wanted=Monday              00:00:00

TZ=Europe/Vilnius - wrong day.
tStamp=Friday 2003-03-28 17:17:17 EET 0
result=Thursday 2003-04-03 23:00:00 EET 0
wanted=Friday            00:00:00

TZ=Pacific/Kwajalein - wrong day.
tStamp=Friday 1993-08-13 17:17:17 KWAT 0
result=Saturday 1993-08-21 00:00:00 MHT 0
wanted=Friday            00:00:00

TZ=Asia/Ulan_Bator - wrong day.
tStamp=Saturday 2001-09-22 17:17:17 ULAST 1
result=Friday 2001-09-28 23:00:00 ULAT 0
wanted=Saturday            00:00:00

TZ=America/Cancun - wrong day.
tStamp=Sunday 2002-04-07 17:17:17 CST 0
result=Saturday 2002-04-13 23:00:00 CST 0
wanted=Sunday            00:00:00

TZ=America/Mexico_City - wrong day.
tStamp=Wednesday 2002-04-03 17:17:17 CST 0
result=Tuesday 2002-04-09 23:00:00 CST 0
wanted=Wednesday            00:00:00

TZ=America/Mazatlan - wrong day.
tStamp=Tuesday 2002-04-02 17:17:17 MST 0
result=Monday 2002-04-08 23:00:00 MST 0
wanted=Tuesday            00:00:00

TZ=America/Chihuahua - wrong day.
tStamp=Thursday 2002-04-04 17:17:17 MST 0
result=Wednesday 2002-04-10 23:00:00 MST 0
wanted=Thursday            00:00:00

TZ=Asia/Kuala_Lumpur - wrong day.
tStamp=Monday 1981-12-28 17:17:17 MALT 0
result=Sunday 1982-01-03 23:30:00 MALT 0
wanted=Monday            00:00:00

TZ=America/Managua - wrong day.
tStamp=Tuesday 2005-04-05 17:17:17 CST 0
result=Monday 2005-04-11 23:00:00 CST 0
wanted=Tuesday            00:00:00

TZ=Pacific/Chatham - wrong day.
tStamp=Monday 1974-10-28 17:17:17 CHAST 0
result=Sunday 1974-11-03 23:00:00 CHAST 0
wanted=Monday            00:00:00

TZ=America/Lima - wrong day.
tStamp=Thursday 1985-12-26 17:17:17 PET 0
result=Wednesday 1986-01-01 23:00:00 PET 0
wanted=Thursday            00:00:00

TZ=Asia/Karachi - wrong day.
tStamp=Friday 2002-04-05 17:17:17 PKT 0
result=Thursday 2002-04-11 23:00:00 PKT 0
wanted=Friday            00:00:00

TZ=Pacific/Pitcairn - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 PNT 0
result=Tuesday 1970-01-06 23:30:00 PNT 0
wanted=Wednesday            00:00:00

TZ=America/Asuncion - wrong day.
tStamp=Wednesday 2002-02-27 17:17:17 PYST 1
result=Tuesday 2002-03-05 23:00:00 PYT 0
wanted=Wednesday            00:00:00

TZ=Asia/Singapore - wrong day.
tStamp=Thursday 1981-12-31 17:17:17 SGT 0
result=Wednesday 1982-01-06 23:30:00 SGT 0
wanted=Thursday             00:00:00

TZ=Pacific/Fakaofo - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 TKT 0
result=Friday 1970-01-02 14:00:00 TKT 0
wanted=Saturday          00:00:00

TZ=America/Montevideo - wrong day.
tStamp=Thursday 2004-09-16 17:17:17 UYT 0
result=Wednesday 2004-09-22 23:00:00 UYT 0
wanted=Thursday             00:00:00

TZ=Pacific/Johnston - wrong day.
tStamp=Thursday 1970-01-01 17:17:17 HST 0
result=Thursday 1970-01-08 14:00:00 HST 0
wanted=Friday              00:00:00

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



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-22 09:32 UTC] nickj-phpbugs at nickj dot org
Also available as a .phpt unit-test here: http://home.swiftdsl.com.au/~npj/php-bugs/bug33414.phpt

(Note: first attempt at a .phpt, so please forgive me if it's not quite right).
 [2005-06-22 11:06 UTC] nickj-phpbugs at nickj dot org
Sorry, one further update - I think it would be better if my test script printed out the exact expected results, rather than just testing for the correct day. The reason that I say this is that I am seeing a possible regression of bug #20382, not just for the Vienna timezone, but for 2 other timezones as well. I.e. when I run these commands:

./get-and-build-php-5.1-dev 200506220830
cd php5-200506220830
# Run the date-related tests:
TEST_PHP_EXECUTABLE=sapi/cli/php sapi/cli/php run-tests.php ../bug33414/bug33414.phpt ext/date/tests/*.phpt
# Can then see the output of bug20382-2 with:
diff -u ext/date/tests/bug20382-2.exp ext/date/tests/bug20382-2.out

Then the diff shows this:
==================================================
ludo:~/tmp/php-5.1-dev/php5-200506220830# # Can then see the output of bug20382-2 with:
ludo:~/tmp/php-5.1-dev/php5-200506220830# diff -u ext/date/tests/bug20382-2.exp ext/date/tests/bug20382-2.out
--- ext/date/tests/bug20382-2.exp       Wed Jun 22 18:58:14 2005
+++ ext/date/tests/bug20382-2.out       Wed Jun 22 18:58:14 2005
@@ -105,17 +105,17 @@
 
 America/Buenos_Aires
 ts     = Monday 1974-09-30 17:17:17 ART
-result = Monday 1974-10-07 00:00:00 ART
+result = Monday 1974-10-07 01:00:00 ARST
 wanted = Monday            00:00:00
 
 America/Rosario
 ts     = Monday 1974-09-30 17:17:17 ART
-result = Monday 1974-10-07 00:00:00 ART
+result = Monday 1974-10-07 01:00:00 ARST
 wanted = Monday            00:00:00
 
 Europe/Vienna
 ts     = Monday 1980-03-31 17:17:17 CET
-result = Monday 1980-04-07 00:00:00 CEST
+result = Sunday 1980-04-06 23:00:00 CET
 wanted = Monday            00:00:00
 
 Asia/Baku
ludo:~/tmp/php-5.1-dev/php5-200506220830# 
==================================================

I.e. Either not getting the expected results in America/Buenos_Aires and America/Rosario, as well as Vienna, or the "--EXPECT--" portion of the test is wrong.
 [2005-07-06 06:14 UTC] nickj-phpbugs at nickj dot org
Most of the test cases are fixed in php5-200507060230 (including the 3 possible regressions listed above from bug #20382).

Just the following 3 seem to be giving incorrect results now (found after doing another exhaustive check on a win32 system, and confirming the results are also incorrect on a Linux system):

<?php 

$tz="Pacific/Kwajalein";
print "TZ=$tz\n";
putenv("TZ=$tz");
$tStamp = mktime (17, 17, 17, 1, 8261, 1971);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday            00:00:00\n\n";

$tz="Pacific/Enderbury";
print "TZ=$tz\n";
putenv("TZ=$tz");
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
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";

$tz="Pacific/Kiritimati";
print "TZ=$tz\n";
putenv("TZ=$tz");
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
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";

?>

Output is:
===========================================
ludo:~/tmp/php-5.1-dev# php5-200507060230/sapi/cli/php bug33414/win32-wrong-days.php 
TZ=Pacific/Kwajalein
tStamp=Friday 1993-08-13 17:17:17 KWAT 0
result=Saturday 1993-08-21 00:00:00 MHT 0
wanted=Friday            00:00:00

TZ=Pacific/Enderbury
tStamp=Sunday 1994-12-25 17:17:17 PHOT 0
result=Monday 1995-01-02 00:00:00 PHOT 0
wanted=Sunday            00:00:00

TZ=Pacific/Kiritimati
tStamp=Sunday 1994-12-25 17:17:17 LINT 0
result=Monday 1995-01-02 00:00:00 LINT 0
wanted=Sunday            00:00:00

ludo:~/tmp/php-5.1-dev#
===========================================
 [2005-09-01 14:42 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-09-05 08:38 UTC] nickj-phpbugs at nickj dot org
Looking very good but I'm still showing just a handful that are giving the wrong days, namely:

===================================================================
ludo:~/tmp/php-5.1-dev# cat my-bugs/bug33414/win32-wrong-days.php
<?php 

$tz="Pacific/Kwajalein";
print "TZ=$tz\n";
putenv("TZ=$tz");
$tStamp = mktime (17, 17, 17, 1, 8261, 1971);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
$strtotime_tstamp = strtotime("Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday            00:00:00\n\n";

$tz="Pacific/Enderbury";
print "TZ=$tz\n";
putenv("TZ=$tz");
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
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";

$tz="Pacific/Kiritimati";
print "TZ=$tz\n";
putenv("TZ=$tz");
$tStamp = mktime (17, 17, 17, 1, 8760, 1971);
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";

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

Output with the 5.1.x-dev CVS snapshot from 200509050430 on a Linux system:
===================================================================
ludo:~/tmp/php-5.1-dev# php5-200509050430/sapi/cli/php my-bugs/bug33414/win32-wrong-days.php
TZ=Pacific/Kwajalein
tStamp=Friday 1993-08-13 17:17:17 KWAT 0
result=Saturday 1993-08-21 00:00:00 MHT 0
wanted=Friday            00:00:00

TZ=Pacific/Enderbury
tStamp=Sunday 1994-12-25 17:17:17 PHOT 0
result=Monday 1995-01-02 00:00:00 PHOT 0
wanted=Sunday            00:00:00

TZ=Pacific/Kiritimati
tStamp=Sunday 1994-12-25 17:17:17 LINT 0
result=Monday 1995-01-02 00:00:00 LINT 0
wanted=Sunday            00:00:00

ludo:~/tmp/php-5.1-dev# 
===================================================================
 [2005-10-07 23:49 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.

Those three are correct, the mentioned days simply don't exist as at this time the zones switched from -11 to +13 or similar:

derick@kossu:~$ zdump -v Pacific/Kwajalein
Pacific/Kwajalein  Fri Aug 20 11:59:59 1993 UTC = Thu Aug 19 23:59:59 1993 MHT isdst=0 gmtoff=-43200
Pacific/Kwajalein  Fri Aug 20 12:00:00 1993 UTC = Sat Aug 21 00:00:00 1993 MHT isdst=0 gmtoff=43200

derick@kossu:~$ zdump -v Pacific/Enderbury
Pacific/Enderbury  Sun Jan  1 10:59:59 1995 UTC = Sat Dec 31 23:59:59 1994 PHOT isdst=0 gmtoff=-39600
Pacific/Enderbury  Sun Jan  1 11:00:00 1995 UTC = Mon Jan  2 00:00:00 1995 PHOT isdst=0 gmtoff=46800

derick@kossu:~$ zdump -v Pacific/Kiritimati
Pacific/Kiritimati  Sun Jan  1 09:59:59 1995 UTC = Sat Dec 31 23:59:59 1994 LINT isdst=0 gmtoff=-36000
Pacific/Kiritimati  Sun Jan  1 10:00:00 1995 UTC = Mon Jan  2 00:00:00 1995 LINT isdst=0 gmtoff=50400

 [2005-10-10 03:52 UTC] nickj-phpbugs at nickj dot org
You are quite correct. I apologize for reopening. I honestly never knew that a time shift could skip a day - how bizarre!

Here is an abstract of a New York Times article about the 1993 Kwajalein jump:
http://select.nytimes.com/gst/abstract.html?res=F00610F73D5A0C718EDDA10894DB494D81 , and there is a little bit of info about it here too: http://en.wikipedia.org/wiki/Time_zone#UTC_.2B_12.2C_M

Here is some info about the 1994/1995 Kiribati jump: http://wikitravel.org/en/Kiribati#Understand . As for Enderbury, after 1979 it became part of Kiribati (ref: http://en.wikipedia.org/wiki/Enderbury_Island ), which explains why it has the same jump as Kiribati.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 04:01:31 2024 UTC