]> granicus.if.org Git - php/commitdiff
- Fixed tests on Windows
authorFelipe Pena <felipe@php.net>
Tue, 12 May 2009 19:46:58 +0000 (19:46 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 12 May 2009 19:46:58 +0000 (19:46 +0000)
28 files changed:
ext/date/tests/002.phpt
ext/date/tests/009_win32.phpt
ext/date/tests/bug13142.phpt
ext/date/tests/bug14561.phpt
ext/date/tests/bug17988.phpt
ext/date/tests/bug20382-1.phpt
ext/date/tests/bug20382-2.phpt
ext/date/tests/bug21399.phpt
ext/date/tests/bug21966.phpt
ext/date/tests/bug26090.phpt
ext/date/tests/bug26317.phpt
ext/date/tests/bug26320.phpt
ext/date/tests/bug26694.phpt
ext/date/tests/bug27719.phpt
ext/date/tests/bug27780.phpt
ext/date/tests/bug28024.phpt
ext/date/tests/bug29150.phpt
ext/date/tests/bug30532.phpt
ext/date/tests/bug32086.phpt
ext/date/tests/bug32270.phpt
ext/date/tests/bug32555.phpt
ext/date/tests/bug32588.phpt
ext/date/tests/bug33414-1.phpt
ext/date/tests/bug33414-2.phpt
ext/date/tests/bug33415-1.phpt
ext/date/tests/bug33532.phpt
ext/date/tests/bug35425.phpt
ext/date/tests/date_default_timezone_get-3.phpt

index 7384b7424469b00d5a4658db1b2090f1cc889061..92d0d5f105c63539f9103bb0fc6f1402b5e0c88c 100644 (file)
@@ -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) {
index 6121f625b4fcd0fe1ba094fdb1e6f931e67f064d..cbdc8b7c0a8509f6fde4c0d99b511396c707c508 100644 (file)
@@ -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
index 5e54263c5493290c90bb6b51fadf07ae24a67242..60fc7e7f6eaedd5035b4496b849cba1aee1a9fbc 100644 (file)
@@ -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");
 }
index 98638c3e4b525429bd1fb9c1b0a69107d5968ead..86a64fd8cd4668cbef61290b67704a445e11b8eb 100644 (file)
@@ -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";
 ?>
index 259fa7dc2e3bdc6635204c269ff73a10d1c91ee7..e758b16aedf013870e030184c2ff0abb377dbfeb 100644 (file)
@@ -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";
index a259d934af1d6959bbc14425e860beaa0b578748..e81ac20fd33fdada51a86016881bb623b9fee28a 100644 (file)
@@ -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";
        
index 2026ed44da41505bf3b83f503c3fa4f06bf95b31..e1f8369d2a1297438a064894517ab73d411991af 100644 (file)
@@ -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);
index 08040bec5430742aed44d86030c5ee2ca8663625..a295c8bd8b549f3f758720b0e080b99b93b679c6 100644 (file)
@@ -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--
index 31f592fa98407fce6e09fd7b5edcc95045ba2599..353e7e598512faf1ed5bfd20082bf63a28efb4a5 100644 (file)
@@ -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
index 03a90352cc09214b04f5d37de0d3d26efae967bf..4b81949c779b46ddcecd7404016c4c60c483db2c 100644 (file)
@@ -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";
 
index aef29035e2a9178b177df13e7e5f3bed97a41c0a..5b79bec525ca44fe1c472aee9850787eb775a67c 100644 (file)
@@ -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"));
index 5b237cadbf1cb8210a1062084a73794a850bc2ef..c8aeb00c9f8e0e57d1451bd26295f320ce73063f 100644 (file)
@@ -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"));
 ?>
index a709d1666c3351b9934039975b54760e0e073edc..939b04c1364e72ce1749125926bc9a1fa19a5f4a 100644 (file)
@@ -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--
index 6f65bfb85e0a2699520ef322b6d930d32e311470..88c17704e505046af8f66227572e9ae4d028f584 100644 (file)
@@ -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);
index f1e6eb67bd9e9a155c4f52806651d5c7900b41b5..bd3bc949bd2b9b6c0ec0653468ff865324b01c10 100644 (file)
@@ -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) {
index 3e0399adbed3be6009a8628ed52df9b5c32dcedc..b5f97bd5c94906ada373eb448941d9c97c500b7a 100644 (file)
@@ -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"));
 ?>
index 274584d050842f4216f5f227fb4209f685951752..d91d68d9199242aaab2379f6f498e865d7d180e9 100644 (file)
@@ -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--
index faee0b316f32c2fcb8d71212a80b08b304aab628..6794b9dc7a9547f99960d8f0a200b3571d488266 100644 (file)
@@ -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";
index 2799164cb1842a5e496957d62b149f389bf88418..e065c0bac212867ba524f3908e9c71847189a8b5 100644 (file)
@@ -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";
index 2c5ff4754980315cae5ef978687173c2d3354da1..4533e061438a2bc3eafeed65689c23cad44f3d1f 100644 (file)
@@ -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";
 
index 3ef513b5e902f00fc3e93cc6408527e7209faf5e..a99d3e289072f4aeeeffb45e882ab97b839d7492 100644 (file)
@@ -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";
index 6cf5ac92f85ff7b1665c0180815982be8101d95e..4ecadf4e9be90727c08f8be2c6af3ffa43c238ca 100644 (file)
@@ -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";
index 7b15228cf348b1df22200ec0d3b629b335862138..03d9b4ca9fc7c12233f9198666e2bdc4dec8f062 100644 (file)
@@ -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);
index 8eb2a3569722746a313b4394320d058b88806146..51cbe3b9f1c7a7fc93b9875ba60d0166d19caa34 100644 (file)
@@ -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);
index 3d36af8a53329e42b0502d8adeff81a0e9e377ae..698252a03245f1a29c246e2946549ec7bdd49740 100644 (file)
@@ -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);
index 2a8da034120c9fff72ba65ac3d74f18f438001aa..286ceb4cec0180cd5c341d451c145e60c00f5b0d 100644 (file)
@@ -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);
index 4259b49a1c4fce42fe963f30fb76186a450d0961..e55a4f521917cf58c01723436147e51eb5c6c42a 100644 (file)
@@ -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) {
index 0e2e3c53e558a9db4f9fac175904ea46d9178a93..ffc882e6f684f78b7f5c71b9a00c5078678f8fd2 100644 (file)
@@ -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");