diff options
28 files changed, 92 insertions, 72 deletions
diff --git a/ext/date/tests/002.phpt b/ext/date/tests/002.phpt index 7384b74244..92d0d5f105 100644 --- a/ext/date/tests/002.phpt +++ b/ext/date/tests/002.phpt @@ -32,16 +32,16 @@ if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') { ); echo "*** GMT0\n"; - putenv ("TZ=GMT0"); + date_default_timezone_set("GMT0"); foreach ($dates as $date) { echo date ("Y-m-d H:i:s\n", strtotime ($date)); } echo "*** US/Eastern\n"; - putenv("TZ=US/Eastern"); + date_default_timezone_set("US/Eastern"); if( date("T") == "GMT" ) { // POSIX style - putenv ("TZ=EST5EDT4,M4.1.0,M10.5.0"); + date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0"); } foreach ($dates as $date) { diff --git a/ext/date/tests/009_win32.phpt b/ext/date/tests/009_win32.phpt index 6121f625b4..cbdc8b7c0a 100644 --- a/ext/date/tests/009_win32.phpt +++ b/ext/date/tests/009_win32.phpt @@ -34,17 +34,17 @@ var_dump(gmstrftime("blah", $t)); echo "Done\n"; ?> --EXPECTF-- -Warning: strftime() expects at least 1 parameter, 0 given in C:\Users\pierre\Documents\php-sdk\vc9\x86\php_5_3\ext\date\tests\009_win32.php on line 5 +Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d bool(false) bool(false) -string(147) "Tue Tuesday Jun June 06/27/06 00:00:00 27 00 12 178 06 00 AM 00 26 26 2 06/27/06 00:00:00 06 2006 W. Europe Daylight Time W. Europe Daylight Time %" +string(%d) "Tue Tuesday Jun June 06/27/06 00:00:00 27 00 12 178 06 00 AM 00 26 26 2 06/27/06 00:00:00 06 2006 %s" string(5) "%q %a" string(4) "blah" -Warning: gmstrftime() expects at least 1 parameter, 0 given in C:\Users\pierre\Documents\php-sdk\vc9\x86\php_5_3\ext\date\tests\009_win32.php on line 15 +Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d bool(false) bool(false) -string(146) "Mon Monday Jun June 06/26/06 21:00:00 26 21 09 177 06 00 PM 00 26 26 1 06/26/06 21:00:00 06 2006 W. Europe Standard Time W. Europe Standard Time %" +string(%d) "Mon Monday Jun June 06/26/06 21:00:00 26 21 09 177 06 00 PM 00 26 26 1 06/26/06 21:00:00 06 2006 %s" string(5) "%q %a" string(4) "blah" Done diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt index 5e54263c54..60fc7e7f6e 100644 --- a/ext/date/tests/bug13142.phpt +++ b/ext/date/tests/bug13142.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #13142 (strtotime handling of "M d H:i:s Y" format) +--INI-- +date.timezone=US/Eastern --SKIPIF-- <?php if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') { @@ -8,7 +10,7 @@ if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') { ?> --FILE-- <?php -putenv("TZ=US/Eastern"); + if (date('T') == 'GMT') { putenv("TZ=EST5EDT4,M4.1.0,M10.5.0"); } diff --git a/ext/date/tests/bug14561.phpt b/ext/date/tests/bug14561.phpt index 98638c3e4b..86a64fd8cd 100644 --- a/ext/date/tests/bug14561.phpt +++ b/ext/date/tests/bug14561.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #14561 (strtotime() bug) +--INI-- +date.timezone=GMT --FILE-- <?php -putenv("TZ=GMT"); echo strtotime("19:30 Dec 17 2005"), "\n"; echo strtotime("Dec 17 19:30 2005"), "\n"; ?> diff --git a/ext/date/tests/bug17988.phpt b/ext/date/tests/bug17988.phpt index 259fa7dc2e..e758b16aed 100644 --- a/ext/date/tests/bug17988.phpt +++ b/ext/date/tests/bug17988.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #17988 (strtotime handling of postgresql timestamps) +--INI-- +date.timezone=GMT --FILE-- <?php -putenv("TZ=GMT"); echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n"; echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n"; echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n"; diff --git a/ext/date/tests/bug20382-1.phpt b/ext/date/tests/bug20382-1.phpt index a259d934af..e81ac20fd3 100644 --- a/ext/date/tests/bug20382-1.phpt +++ b/ext/date/tests/bug20382-1.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #20382 [1] (strtotime ("Monday", $date) produces wrong result on DST changeover) +--INI-- +date.timezone=Europe/Amsterdam --FILE-- <?php - putenv("TZ=Europe/Amsterdam"); $tStamp = mktime (17, 17, 17, 10, 27, 2004); echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n"; diff --git a/ext/date/tests/bug20382-2.phpt b/ext/date/tests/bug20382-2.phpt index 2026ed44da..e1f8369d2a 100644 --- a/ext/date/tests/bug20382-2.phpt +++ b/ext/date/tests/bug20382-2.phpt @@ -32,7 +32,7 @@ $tests = array( ); foreach ($tests as $test) { - putenv("TZ={$test[0]}"); + date_default_timezone_set($test[0]); print "{$test[0]}\n"; array_shift($test); $timestamp = call_user_func_array('mktime', $test); diff --git a/ext/date/tests/bug21399.phpt b/ext/date/tests/bug21399.phpt index 08040bec54..a295c8bd8b 100644 --- a/ext/date/tests/bug21399.phpt +++ b/ext/date/tests/bug21399.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #21399 (strtotime() request for "YYYYMMDDhhmmss [ZZZ]") +--INI-- +date.timezone=GMT --FILE-- <?php - putenv("TZ=GMT"); echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT")); ?> --EXPECT-- diff --git a/ext/date/tests/bug21966.phpt b/ext/date/tests/bug21966.phpt index 31f592fa98..353e7e5985 100644 --- a/ext/date/tests/bug21966.phpt +++ b/ext/date/tests/bug21966.phpt @@ -1,9 +1,9 @@ --TEST-- Bug #21966 (date() or mktime() returning bad value for mktime month param of '2') +--INI-- +date.timezone=Europe/London --FILE-- <?php -putenv("TZ=Europe/London"); - echo '27/3/04 = ' . strval(mktime(0,0,0,3,27,2004)) . "\n"; // 1080345600 echo '28/3/04 = ' . strval(mktime(0,0,0,3,28,2004)) . "\n"; // -3662 - should be 108043200 echo '28/3/04 = ' . strval(mktime(2,0,0,3,28,2004)) . "\n"; // 1080435600 diff --git a/ext/date/tests/bug26090.phpt b/ext/date/tests/bug26090.phpt index 03a90352cc..4b81949c77 100644 --- a/ext/date/tests/bug26090.phpt +++ b/ext/date/tests/bug26090.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #26090 (allow colons in time zone offset to strtotime()) +--INI-- +date.timezone=America/New_York --FILE-- <?php -putenv("TZ=America/New_York"); $t = '2003-10-28 10:20:30-0800'; echo date('Y-m-d H:i:s T', strtotime($t)) . "\n"; diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt index aef29035e2..5b79bec525 100644 --- a/ext/date/tests/bug26317.phpt +++ b/ext/date/tests/bug26317.phpt @@ -1,12 +1,13 @@ --TEST-- Bug #26317 (military timezone offset signedness) +--INI-- +date.timezone=GMT0 --SKIPIF-- if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { die("skip unable to change TZ enviroment variable\n"); } --FILE-- <?php - putenv("TZ=GMT0"); echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z")); echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T")); echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C")); diff --git a/ext/date/tests/bug26320.phpt b/ext/date/tests/bug26320.phpt index 5b237cadbf..c8aeb00c9f 100644 --- a/ext/date/tests/bug26320.phpt +++ b/ext/date/tests/bug26320.phpt @@ -1,12 +1,13 @@ --TEST-- Bug #26320 (strtotime handling of XML Schema/ISO 8601 format) +--INI-- +date.timezone=GMT0 --SKIPIF-- if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { die("skip unable to change TZ enviroment variable\n"); } --FILE-- <?php - putenv("TZ=GMT0"); echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42")); echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z")); ?> diff --git a/ext/date/tests/bug26694.phpt b/ext/date/tests/bug26694.phpt index a709d1666c..939b04c136 100644 --- a/ext/date/tests/bug26694.phpt +++ b/ext/date/tests/bug26694.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #26694 (strtotime() request for "Sun, 21 Dec 2003 20:38:33 +0000 GMT") +--INI-- +date.timezone=GMT --FILE-- <?php - putenv("TZ=GMT"); echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT")); ?> --EXPECT-- diff --git a/ext/date/tests/bug27719.phpt b/ext/date/tests/bug27719.phpt index 6f65bfb85e..88c17704e5 100644 --- a/ext/date/tests/bug27719.phpt +++ b/ext/date/tests/bug27719.phpt @@ -1,10 +1,10 @@ --TEST-- Bug #27719 (mktime returns incorrect timestamp for dst days) --INI-- +date.timezone=EST error_reporting=2047 --FILE-- <?php /* $Id$ */ - putenv("TZ=EST"); // No DST $a = mktime(0, 0, 0, 4, 4, 2004, 0); $b = mktime(0, 0, 0, 4, 4, 2004, 1); $c = mktime(0, 0, 0, 4, 4, 2004, -1); @@ -12,7 +12,7 @@ error_reporting=2047 echo "$b ".date("m/d/y h:i:s\n",$b); echo "$c ".date("m/d/y h:i:s\n",$c); echo "\n"; - putenv("TZ=EST5EDT"); // DST not in effect + date_default_timezone_set('EST5EDT'); // DST not in effect $a = mktime(0, 0, 0, 2, 4, 2004, 0); $b = mktime(0, 0, 0, 2, 4, 2004, 1); $c = mktime(0, 0, 0, 2, 4, 2004, -1); @@ -20,7 +20,7 @@ error_reporting=2047 echo "$b ".date("m/d/y h:i:s\n",$b); echo "$c ".date("m/d/y h:i:s\n",$c); echo "\n"; - putenv("TZ=EST5EDT"); // Just before DST changeover + date_default_timezone_set('EST5EDT'); $a = mktime(0, 0, 0, 4, 4, 2004, 0); $b = mktime(0, 0, 0, 4, 4, 2004, 1); $c = mktime(0, 0, 0, 4, 4, 2004, -1); @@ -28,7 +28,7 @@ error_reporting=2047 echo "$b ".date("m/d/y h:i:s\n",$b); echo "$c ".date("m/d/y h:i:s\n",$c); echo "\n"; - putenv("TZ=EST5EDT"); // Just after DST changeover + date_default_timezone_set('EST5EDT'); $a = mktime(3, 0, 0, 4, 4, 2004, 0); $b = mktime(3, 0, 0, 4, 4, 2004, 1); $c = mktime(3, 0, 0, 4, 4, 2004, -1); @@ -36,7 +36,7 @@ error_reporting=2047 echo "$b ".date("m/d/y h:i:s\n",$b); echo "$c ".date("m/d/y h:i:s\n",$c); echo "\n"; - putenv("TZ=EST5EDT"); // DST in effect + date_default_timezone_set('EST5EDT'); $a = mktime(0, 0, 0, 6, 4, 2004, 0); $b = mktime(0, 0, 0, 6, 4, 2004, 1); $c = mktime(0, 0, 0, 6, 4, 2004, -1); diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt index f1e6eb67bd..bd3bc949bd 100644 --- a/ext/date/tests/bug27780.phpt +++ b/ext/date/tests/bug27780.phpt @@ -24,7 +24,7 @@ $timestrings = array ( ); foreach ($timezones as $timezone) { - putenv("TZ=$timezone"); + date_default_timezone_set($timezone); echo $timezone, "\n"; foreach ($timestrings as $timestring) { diff --git a/ext/date/tests/bug28024.phpt b/ext/date/tests/bug28024.phpt index 3e0399adbe..b5f97bd5c9 100644 --- a/ext/date/tests/bug28024.phpt +++ b/ext/date/tests/bug28024.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #28024 (Changed behavior of strtotime()) +--INI-- +date.timezone=Europe/Berlin --FILE-- <?php - putenv("TZ=Europe/Berlin"); echo strtotime("17:00 2004-01-01"), "\n"; echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01")); ?> diff --git a/ext/date/tests/bug29150.phpt b/ext/date/tests/bug29150.phpt index 274584d050..d91d68d919 100644 --- a/ext/date/tests/bug29150.phpt +++ b/ext/date/tests/bug29150.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #29150 (Roman number format for months) +--INI-- +date.timezone=GMT --FILE-- <?php - putenv("TZ=GMT"); echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005")); ?> --EXPECT-- diff --git a/ext/date/tests/bug30532.phpt b/ext/date/tests/bug30532.phpt index faee0b316f..6794b9dc7a 100644 --- a/ext/date/tests/bug30532.phpt +++ b/ext/date/tests/bug30532.phpt @@ -1,8 +1,10 @@ --TEST-- Bug #30532 (strtotime - crossing daylight savings time) +--INI-- +date.timezone=America/New_York --FILE-- <?php -putenv("TZ=America/New_York"); + echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +1 hour'))."\n"; echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +2 hours'))."\n"; echo date('Y-m-d H:i:s T', strtotime('2004-10-31 EDT +3 hours'))."\n"; diff --git a/ext/date/tests/bug32086.phpt b/ext/date/tests/bug32086.phpt index 2799164cb1..e065c0bac2 100644 --- a/ext/date/tests/bug32086.phpt +++ b/ext/date/tests/bug32086.phpt @@ -1,8 +1,10 @@ --TEST-- Bug #32086 (strtotime don't work in DST) +--INI-- +date.timezone=America/Sao_Paulo --FILE-- <?php -putenv("TZ=America/Sao_Paulo"); + echo $g = strtotime("2004-11-01"), "\n"; echo $i = strtotime("2004-11-01 +1 day"), "\n"; echo $j = strtotime("+1 day", $g), "\n"; diff --git a/ext/date/tests/bug32270.phpt b/ext/date/tests/bug32270.phpt index 2c5ff47549..4533e06143 100644 --- a/ext/date/tests/bug32270.phpt +++ b/ext/date/tests/bug32270.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #32270 (strtotime/date behavior) +--INI-- +date.timezone=America/Los_Angeles --FILE-- <?php -putenv("TZ=America/Los_Angeles"); echo date("m/d/Y H:i:s T", -2145888000)."\n"; diff --git a/ext/date/tests/bug32555.phpt b/ext/date/tests/bug32555.phpt index 3ef513b5e9..a99d3e2890 100644 --- a/ext/date/tests/bug32555.phpt +++ b/ext/date/tests/bug32555.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #32555 (strtotime("tomorrow") can return false) +--INI-- +date.timezone=US/Eastern --FILE-- <?php -putenv("TZ=US/Eastern"); $stamp = 1112427000; print strftime('%c %Z',strtotime('now',$stamp)) ."\n"; diff --git a/ext/date/tests/bug32588.phpt b/ext/date/tests/bug32588.phpt index 6cf5ac92f8..4ecadf4e9b 100644 --- a/ext/date/tests/bug32588.phpt +++ b/ext/date/tests/bug32588.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #32588 (strtotime() error for 'last xxx' DST problem) +--INI-- +date.timezone=America/New_York --FILE-- <?php -putenv("TZ=America/New_York"); echo date('D Y/m/d/H:i:s', strtotime('last saturday', 1112703348)). "\n"; echo date('D Y/m/d/H:i:s', strtotime("last sunday", 1112703348)). "\n"; diff --git a/ext/date/tests/bug33414-1.phpt b/ext/date/tests/bug33414-1.phpt index 7b15228cf3..03d9b4ca9f 100644 --- a/ext/date/tests/bug33414-1.phpt +++ b/ext/date/tests/bug33414-1.phpt @@ -1,10 +1,11 @@ --TEST-- Bug #33414 [1] (Comprehensive list of incorrect days returned after strotime() / date() tests) +--INI-- +date.timezone=America/Mendoza --FILE-- <?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("next Sunday", $tStamp); @@ -12,7 +13,7 @@ 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"); +date_default_timezone_set("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("next Sunday", $tStamp); @@ -20,7 +21,7 @@ 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"); +date_default_timezone_set("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("next Sunday", $tStamp); @@ -28,7 +29,7 @@ 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"); +date_default_timezone_set("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("next Tuesday", $tStamp); @@ -37,7 +38,7 @@ 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"); +date_default_timezone_set("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("next Thursday", $tStamp); @@ -45,7 +46,7 @@ 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"); +date_default_timezone_set("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("next Sunday", $tStamp); @@ -53,7 +54,7 @@ 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"); +date_default_timezone_set("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("next Friday", $tStamp); @@ -61,7 +62,7 @@ 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=America/Havana - wrong day.\n"; -putenv("TZ=America/Havana"); +date_default_timezone_set("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("next Thursday", $tStamp); @@ -69,7 +70,7 @@ 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"); +date_default_timezone_set("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("next Saturday", $tStamp); @@ -77,7 +78,7 @@ 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/Jerusalem - wrong day.\n"; -putenv("TZ=Asia/Jerusalem"); +date_default_timezone_set("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("next Thursday", $tStamp); @@ -85,7 +86,7 @@ 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/Vilnius - wrong day.\n"; -putenv("TZ=Europe/Vilnius"); +date_default_timezone_set("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("next Friday", $tStamp); @@ -93,7 +94,7 @@ 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"); +date_default_timezone_set("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("next Friday", $tStamp); @@ -101,7 +102,7 @@ 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"); +date_default_timezone_set("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("next Saturday", $tStamp); @@ -109,7 +110,7 @@ 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"); +date_default_timezone_set("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("next Sunday", $tStamp); @@ -117,7 +118,7 @@ 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"); +date_default_timezone_set("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("next Wednesday", $tStamp); @@ -125,7 +126,7 @@ 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"); +date_default_timezone_set("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("next Tuesday", $tStamp); @@ -133,7 +134,7 @@ 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"); +date_default_timezone_set("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("next Thursday", $tStamp); @@ -141,7 +142,7 @@ 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"); +date_default_timezone_set("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("next Monday", $tStamp); @@ -149,7 +150,7 @@ 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/Chatham - wrong day.\n"; -putenv("TZ=Pacific/Chatham"); +date_default_timezone_set("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("next Monday", $tStamp); @@ -157,7 +158,7 @@ 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"); +date_default_timezone_set("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("next Thursday", $tStamp); @@ -165,7 +166,7 @@ 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"); +date_default_timezone_set("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("next Friday", $tStamp); @@ -173,7 +174,7 @@ 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=America/Asuncion - wrong day.\n"; -putenv("TZ=America/Asuncion"); +date_default_timezone_set("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("next Wednesday", $tStamp); @@ -181,7 +182,7 @@ 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"); +date_default_timezone_set("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("next Thursday", $tStamp); @@ -189,7 +190,7 @@ 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/Montevideo - wrong day.\n"; -putenv("TZ=America/Montevideo"); +date_default_timezone_set("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("next Thursday", $tStamp); diff --git a/ext/date/tests/bug33414-2.phpt b/ext/date/tests/bug33414-2.phpt index 8eb2a35697..51cbe3b9f1 100644 --- a/ext/date/tests/bug33414-2.phpt +++ b/ext/date/tests/bug33414-2.phpt @@ -3,7 +3,7 @@ Bug #33414 [2] (Comprehensive list of incorrect days returned after strotime() / --FILE-- <?php print "TZ=Pacific/Rarotonga - wrong day.\n"; -putenv("TZ=Pacific/Rarotonga"); +date_default_timezone_set("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("next Tuesday", $tStamp); @@ -11,7 +11,7 @@ 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=Atlantic/South_Georgia - wrong day.\n"; -putenv("TZ=Atlantic/South_Georgia"); +date_default_timezone_set("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("next Tuesday", $tStamp); @@ -19,7 +19,7 @@ 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"); +date_default_timezone_set("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("next Monday", $tStamp); @@ -27,7 +27,7 @@ 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/Enderbury - wrong day, off by 2 days.\n"; -putenv("TZ=Pacific/Enderbury"); +date_default_timezone_set("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("next Monday", $tStamp); @@ -35,7 +35,7 @@ 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"); +date_default_timezone_set("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("next Monday", $tStamp); @@ -43,7 +43,7 @@ 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"); +date_default_timezone_set("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("next Tuesday", $tStamp); @@ -51,7 +51,7 @@ 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/Pitcairn - wrong day.\n"; -putenv("TZ=Pacific/Pitcairn"); +date_default_timezone_set("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("next Wednesday", $tStamp); @@ -59,7 +59,7 @@ 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/Fakaofo - wrong day.\n"; -putenv("TZ=Pacific/Fakaofo"); +date_default_timezone_set("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("next Saturday", $tStamp); @@ -67,7 +67,7 @@ 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/Johnston - wrong day.\n"; -putenv("TZ=Pacific/Johnston"); +date_default_timezone_set("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("next Friday", $tStamp); diff --git a/ext/date/tests/bug33415-1.phpt b/ext/date/tests/bug33415-1.phpt index 3d36af8a53..698252a032 100644 --- a/ext/date/tests/bug33415-1.phpt +++ b/ext/date/tests/bug33415-1.phpt @@ -5,7 +5,7 @@ Bug #33415 [1] (Possibly invalid non-one-hour DST or timezone shifts) 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"); +date_default_timezone_set("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("next Monday", $tStamp); @@ -13,7 +13,7 @@ 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"); +date_default_timezone_set("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("next Sunday", $tStamp); diff --git a/ext/date/tests/bug33532.phpt b/ext/date/tests/bug33532.phpt index 2a8da03412..286ceb4cec 100644 --- a/ext/date/tests/bug33532.phpt +++ b/ext/date/tests/bug33532.phpt @@ -5,7 +5,7 @@ error_reporting=2047 date.timezone=UTC --FILE-- <?php -putenv("TZ="); + setlocale(LC_ALL, 'C'); print "TZ has NOT been set\n"; @@ -17,7 +17,7 @@ print "strftime " . strftime("%r %B%e %Y %Z %z", $tStamp) . "\n"; print "datestr " . date ("H:i:s A F j Y T", $tStamp) . "\n"; print "\nSetting TZ\n"; -putenv("TZ=Australia/Sydney"); +date_default_timezone_set('Australia/Sydney'); $input = "10:00:00 AM July 1 2005"; print "input " . $input . "\n"; $tStamp = strtotime($input); diff --git a/ext/date/tests/bug35425.phpt b/ext/date/tests/bug35425.phpt index 4259b49a1c..e55a4f5219 100644 --- a/ext/date/tests/bug35425.phpt +++ b/ext/date/tests/bug35425.phpt @@ -1,8 +1,9 @@ --TEST-- Bug #35425 (idate() function ignores timezone settings) +--INI-- +date.timezone=America/Montreal --FILE-- <?php -putenv('TZ=America/Montreal'); $time = mktime(1,1,1,1,1,2005); foreach (array('B','d','h','H','i','I','L','m','s','t','U','w','W','y','Y','z','Z') as $v) { diff --git a/ext/date/tests/date_default_timezone_get-3.phpt b/ext/date/tests/date_default_timezone_get-3.phpt index 0e2e3c53e5..ffc882e6f6 100644 --- a/ext/date/tests/date_default_timezone_get-3.phpt +++ b/ext/date/tests/date_default_timezone_get-3.phpt @@ -1,10 +1,9 @@ --TEST-- date_default_timezone_get() function [3] --INI-- -date.timezone= +date.timezone=Europe/Rome --FILE-- <?php - putenv('TZ=Europe/Rome'); echo date_default_timezone_get(), "\n"; date_default_timezone_set("America/Chicago"); |