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 New Comment:
These new tests are all correct, except the one for Vienna and perhaps the one for Lord Howe. They are correct because there is no 00:00 for those specific dates, as the time goes from: 23:59 winter time to 01:00 summer time the clock is set an hour forward there. I'll check out the Vienna and Lord Howe ones now, can you please file a different bug for the rendering problem on Windows? Previous Comments: ------------------------------------------------------------------------ [2005-06-19 03:44:18] nickj-phpbugs at nickj dot org That's a lot better, it takes much longer to find problems, but there are still some cases it doesn't seem to work on (using the same Debian GNU/Linux Woody 3.0r6 system), such as: =============================================================== <?php 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, 4102, 1970); print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n"; $strtotime_tstamp = strtotime("Wednesday", $tStamp); print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n"; print "wanted=Wednesday 00:00:00\n\n"; putenv("TZ=Antarctica/Palmer"); $tStamp = mktime (17, 17, 17, 1, 1477, 1970); print "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n"; $strtotime_tstamp = strtotime("Wednesday", $tStamp); print "result=".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n"; print "wanted=Wednesday 00:00:00\n\n"; putenv("TZ=America/Buenos_Aires"); $tStamp = mktime (17, 17, 17, 1, 1734, 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/Rosario"); $tStamp = mktime (17, 17, 17, 1, 1734, 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/Cordoba"); $tStamp = mktime (17, 17, 17, 1, 1734, 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/Jujuy"); $tStamp = mktime (17, 17, 17, 1, 1734, 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/Catamarca"); $tStamp = mktime (17, 17, 17, 1, 1734, 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/Mendoza"); $tStamp = mktime (17, 17, 17, 1, 1734, 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/Vienna"); $tStamp = mktime (17, 17, 17, 1, 3743, 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=Australia/Lord_Howe"); $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/Baku"); $tStamp = mktime (17, 17, 17, 1, 9490, 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"; ?> =============================================================== Which for me gives: =============================================================== ludo:~/tmp/php-5.1-dev/php5-200506182230/sapi/cli# ./php ~/test/19-june-2005-linux-strtotime-tests.php tStamp=Monday 1983-04-11 17:17:17 CET result=Monday 1983-04-18 01:00:00 CEST wanted=Monday 00:00:00 tStamp=Wednesday 1981-03-25 17:17:17 YERT result=Wednesday 1981-04-01 01:00:00 YERST wanted=Wednesday 00:00:00 tStamp=Wednesday 1974-01-16 17:17:17 ART result=Wednesday 1974-01-23 01:00:00 ARST wanted=Wednesday 00:00:00 tStamp=Monday 1974-09-30 17:17:17 ART result=Monday 1974-10-07 01:00:00 ARST wanted=Monday 00:00:00 tStamp=Monday 1974-09-30 17:17:17 ART result=Monday 1974-10-07 01:00:00 ARST wanted=Monday 00:00:00 tStamp=Monday 1974-09-30 17:17:17 ART result=Monday 1974-10-07 01:00:00 ARST wanted=Monday 00:00:00 tStamp=Monday 1974-09-30 17:17:17 ART result=Monday 1974-10-07 01:00:00 ARST wanted=Monday 00:00:00 tStamp=Monday 1974-09-30 17:17:17 ART result=Monday 1974-10-07 01:00:00 ARST wanted=Monday 00:00:00 tStamp=Monday 1974-09-30 17:17:17 ART result=Monday 1974-10-07 01:00:00 ARST wanted=Monday 00:00:00 tStamp=Monday 1980-03-31 17:17:17 CET result=Sunday 1980-04-06 23:00:00 CET wanted=Monday 00:00:00 tStamp=Thursday 1970-01-01 17:17:17 EST result=Sunday 1970-01-04 23:00:00 EST wanted=Monday 00:00:00 tStamp=Monday 1995-12-25 17:17:17 AZT result=Monday 1996-01-01 01:00:00 AZST wanted=Monday 00:00:00 ludo:~/tmp/php-5.1-dev/php5-200506182230/sapi/cli# =============================================================== > About the Windows tests, they are not going to work yet because > on Windows the date() function doesn't understand timezone > names like "Asia/Dubai". This is going to be implement before > 5.1 is released if I have the time. No worries; If this does get added, feel free to let me know, and I can rerun some of the date-related tests on the Win32 platform. ------------------------------------------------------------------------ [2005-06-18 16:10:54] [EMAIL PROTECTED] All those tests run fine for me, perhaps my latest commit already changed this, so please try a new snapshot. About the WIndows tests, they are not going to work yet because on Windows the date() function doesn't understand timezone names like "Asia/Dubai". This is going to be implement before 5.1 is released if I have the time. ------------------------------------------------------------------------ [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