ID: 20382
Updated by: [EMAIL PROTECTED]
Reported By: nickj-phpbugs at nickj dot org
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: *
PHP Version: 5CVS, 4CVS (2004-04-13)
Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2005-06-18 01:29:54] nickj-phpbugs at nickj dot org
Reopening, as the original test case is now working correctly (thank
you!), but there are others that don't appear to be producing the
expected results.
The ones that don't work seem to differ between operating systems. For
Linux, I've included some of these below as a series of ten small,
separate, simple test cases, structured in the format you've indicated
you prefer. Then below that I've included another ten cases for Windows
2000 systems, in the same format:
======================================================
<?php
putenv("TZ=Europe/Andorra");
$tStamp = mktime (17, 17, 17, 1, 24764, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Asia/Dubai");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Asia/Kabul");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Antigua");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Anguilla");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Europe/Tirane");
$tStamp = mktime (17, 17, 17, 1, 4849, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Asia/Yerevan");
$tStamp = mktime (17, 17, 17, 1, 24764, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Curacao");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Africa/Luanda");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Antarctica/McMurdo");
$tStamp = mktime (17, 17, 17, 1, 24743, 1970);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
?>
======================================================
Results (on my system, a Debian GNU/Linux Woody 3.0r6 box), are as
follows:
ludo:~/tmp/php-5.1-dev/php5-200506170030/sapi/cli# ./php
~/test/test-output.php
tStamp=Monday 2037-10-19 17:17:17 CEST
result=Monday 2037-10-26 01:00:00 CET
wanted=Monday 00:00:00
tStamp=Thursday 1970-01-01 17:17:17 GST
result=Monday 1970-01-05 04:00:00 GST
wanted=Monday 00:00:00
tStamp=Thursday 1970-01-01 17:17:17 AFT
result=Monday 1970-01-05 04:30:00 AFT
wanted=Monday 00:00:00
tStamp=Thursday 1970-01-01 17:17:17 AST
result=Sunday 1970-01-04 20:00:00 AST
wanted=Monday 00:00:00
tStamp=Thursday 1970-01-01 17:17:17 AST
result=Sunday 1970-01-04 20:00:00 AST
wanted=Monday 00:00:00
tStamp=Monday 1983-04-11 17:17:17 CET
result=Monday 1983-04-18 01:00:00 CEST
wanted=Monday 00:00:00
tStamp=Monday 2037-10-19 17:17:17 AMST
result=Monday 2037-10-26 04:00:00 AMT
wanted=Monday 00:00:00
tStamp=Thursday 1970-01-01 17:17:17 AST
result=Sunday 1970-01-04 20:00:00 AST
wanted=Monday 00:00:00
tStamp=Thursday 1970-01-01 17:17:17 WAT
result=Monday 1970-01-05 01:00:00 WAT
wanted=Monday 00:00:00
tStamp=Monday 2037-09-28 17:17:17 NZST
result=Monday 2037-10-05 13:00:00 NZDT
wanted=Monday 00:00:00
ludo:~/tmp/php-5.1-dev/php5-200506170030/sapi/cli#
======================================================
However, on a windows 2000 system, the above tests work OK, but these
tests do not:
======================================================
<?php
putenv("TZ=Australia/Adelaide");
$tStamp = mktime (17, 17, 17, 1, 1, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Australia/Darwin");
$tStamp = mktime (17, 17, 17, 1, 88, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Australia/Perth");
$tStamp = mktime (17, 17, 17, 1, 1, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Aruba");
$tStamp = mktime (17, 17, 17, 1, 88, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Asia/Baku");
$tStamp = mktime (17, 17, 17, 1, 1, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Europe/Sarajevo");
$tStamp = mktime (17, 17, 17, 1, 1, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Barbados");
$tStamp = mktime (17, 17, 17, 1, 1, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Asia/Dacca");
$tStamp = mktime (17, 17, 17, 1, 1, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Europe/Brussels");
$tStamp = mktime (17, 17, 17, 1, 1, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Africa/Ouagadougou");
$tStamp = mktime (17, 17, 17, 1, 88, 1971);
print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n";
$strtotime_tstamp = strtotime("Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
?>
======================================================
Results on a Windows 2000 SP4 box, are as follows:
G:\PHP bugs\PHP bug
20382\php5.1-dev\php5-win32-200506171830>php-cgi.exe
..\..\new-test-output.php
Content-type: text/html
X-Powered-By: PHP/5.1.0-dev
tStamp=Friday 1971-01-01 17:17:17 Aus
result=Sunday 1971-01-03 14:30:00 Aus
wanted=Monday 00:00:00
tStamp=Monday 1971-03-29 17:17:17 Aus
result=Monday 1971-04-05 01:00:00 tra
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 Aus
result=Sunday 1971-01-03 16:00:00 Aus
wanted=Monday 00:00:00
tStamp=Monday 1971-03-29 17:17:17 Ame
result=Monday 1971-04-05 01:00:00 ric
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 Asi
result=Sunday 1971-01-03 20:00:00 Asi
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 Eur
result=Sunday 1971-01-03 23:00:00 Eur
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 Ame
result=Monday 1971-01-04 04:00:00 Ame
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 Asi
result=Sunday 1971-01-03 18:00:00 Asi
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 Eur
result=Sunday 1971-01-03 23:00:00 Eur
wanted=Monday 00:00:00
tStamp=Monday 1971-03-29 17:17:17 Afr
result=Monday 1971-04-05 01:00:00 ica
wanted=Monday 00:00:00
G:\PHP bugs\PHP bug 20382\php5.1-dev\php5-win32-200506171830>
====================================================================
And running the win2000 tests on the Linux box give this:
ludo:~/tmp/php-5.1-dev/php5-200506170030/sapi/cli# ./php
~/test/new-test-win2000.php
tStamp=Friday 1971-01-01 17:17:17 CST
result=Monday 1971-01-04 00:00:00 CST
wanted=Monday 00:00:00
tStamp=Monday 1971-03-29 17:17:17 CST
result=Monday 1971-04-05 09:30:00 CST
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 WST
result=Monday 1971-01-04 00:00:00 WST
wanted=Monday 00:00:00
tStamp=Monday 1971-03-29 17:17:17 AST
result=Sunday 1971-04-04 20:00:00 AST
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 BAKT
result=Monday 1971-01-04 00:00:00 BAKT
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 CET
result=Monday 1971-01-04 00:00:00 CET
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 AST
result=Monday 1971-01-04 00:00:00 AST
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 DACT
result=Monday 1971-01-04 00:00:00 DACT
wanted=Monday 00:00:00
tStamp=Friday 1971-01-01 17:17:17 CET
result=Monday 1971-01-04 00:00:00 CET
wanted=Monday 00:00:00
tStamp=Monday 1971-03-29 17:17:17 GMT
result=Monday 1971-04-05 00:00:00 GMT
wanted=Monday 00:00:00
I.e. the 2nd and 4th results are also wrong on Linux, the remaining 8
look correct (so there is some overlap in incorrect results between
operating systems, although most of the time there is not).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/20382
--
Edit this bug report at http://bugs.php.net/?id=20382&edit=1