]> granicus.if.org Git - php/commitdiff
- Removed support for putenv("TZ=..") for setting the timezone.
authorDerick Rethans <derick@php.net>
Tue, 13 Sep 2011 14:48:13 +0000 (14:48 +0000)
committerDerick Rethans <derick@php.net>
Tue, 13 Sep 2011 14:48:13 +0000 (14:48 +0000)
- Removed the timezone guessing algorithm in case the timezone isn't set with
  date.timezone or date_default_timezone_set(). Instead of a guessed timezone,
  "UTC" is now used instead.

ext/date/php_date.c
ext/date/tests/bug28088.phpt
ext/date/tests/bug33415-2.phpt
ext/date/tests/date.phpt
ext/date/tests/date_default_timezone_get-1.phpt
ext/date/tests/date_default_timezone_get-2.phpt
ext/date/tests/date_default_timezone_set-1.phpt
ext/date/tests/mktime-2.phpt
ext/date/tests/timezone-configuration.phpt

index 8cb289bef315ba72e580260036094b273c36ec16..c1fb5a9f30cdf249f15a8131e15ebe012c38a149 100644 (file)
@@ -837,17 +837,10 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, const timelib_
 /* {{{ Helper functions */
 static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
 {
-       char *env;
-
        /* Checking configure timezone */
        if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0)) {
                return DATEG(timezone);
        }
-       /* Check environment variable */
-       env = getenv("TZ");
-       if (env && *env && timelib_timezone_id_is_valid(env, tzdb)) {
-               return env;
-       }
        /* Check config setting for default timezone */
        if (!DATEG(default_timezone)) {
                /* Special case: ext/date wasn't initialized yet */
@@ -862,73 +855,8 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC)
        } else if (*DATEG(default_timezone) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
                return DATEG(default_timezone);
        }
-#if HAVE_TM_ZONE
-       /* Try to guess timezone from system information */
-       {
-               struct tm *ta, tmbuf;
-               time_t     the_time;
-               char      *tzid = NULL;
-               
-               the_time = time(NULL);
-               ta = php_localtime_r(&the_time, &tmbuf);
-               if (ta) {
-                       tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
-               }
-               if (! tzid) {
-                       tzid = "UTC";
-               }
-               
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%s/%.1f/%s' instead", tzid, ta ? ta->tm_zone : "Unknown", ta ? (float) (ta->tm_gmtoff / 3600) : 0, ta ? (ta->tm_isdst ? "DST" : "no DST") : "Unknown");
-               return tzid;
-       }
-#endif
-#ifdef PHP_WIN32
-       {
-               char *tzid;
-               TIME_ZONE_INFORMATION tzi;
-
-               switch (GetTimeZoneInformation(&tzi))
-               {
-                       /* DST in effect */
-                       case TIME_ZONE_ID_DAYLIGHT:
-                               /* If user has disabled DST in the control panel, Windows returns 0 here */
-                               if (tzi.DaylightBias == 0) {
-                                       goto php_win_std_time;
-                               }
-                               
-                               tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.DaylightBias) * -60, 1);
-                               if (! tzid) {
-                                       tzid = "UTC";
-                               }
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/DST' instead", tzid, ((tzi.Bias + tzi.DaylightBias) / -60.0));
-                               break;
-
-                       /* no DST or not in effect */
-                       case TIME_ZONE_ID_UNKNOWN:
-                       case TIME_ZONE_ID_STANDARD:
-                       default:
-php_win_std_time:
-                               tzid = timelib_timezone_id_from_abbr("", (tzi.Bias + tzi.StandardBias) * -60, 0);
-                               if (! tzid) {
-                                       tzid = "UTC";
-                               }
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected '%s' for '%.1f/no DST' instead", tzid, ((tzi.Bias + tzi.StandardBias) / -60.0));
-                               break;
-
-               }
-               return tzid;
-       }
-#elif defined(NETWARE)
-       /* Try to guess timezone from system information */
-       {
-               char *tzid = timelib_timezone_id_from_abbr("", ((_timezone * -1) + (daylightOffset * daylightOnOff)), daylightOnOff);
-               if (tzid) {
-                       return tzid;
-               }
-       }
-#endif
        /* Fallback to UTC */
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm");
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.");
        return "UTC";
 }
 
index 95866e00be4610c6bb1bd180ec2fa53413e7da46..c310139383520c025c49d08f4e4b9fb2990cfed8 100644 (file)
@@ -1,9 +1,9 @@
 --TEST--
 Bug #28088 (strtotime() cannot convert 00 hours")
+--INI--
+date.timezone=UTC
 --FILE--
 <?php
-putenv("TZ=GMT");
-
 echo "The following line rightly shows the correct date time:\n";
 echo gmdate("m/d/y Hi", strtotime("04/04/04 2345")), "\n";
 
index 50fface88b26825bdbda21b9119b1042990ce681..424be76fc4f5e8c0a4181f0969bdbc0206e2fed5 100644 (file)
@@ -2,14 +2,10 @@
 Bug #33415 [2] (Possibly invalid non-one-hour DST or timezone shifts)
 --FILE--
 <?php
+date_default_timezone_set('Africa/Bujumbura');
 
 print "TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to
 have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Africa/Bujumbura');
-} else {
-       putenv("TZ=Africa/Bujumbura");
-}
 $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);
@@ -17,11 +13,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/Thimbu - Is it OK for this to be 0:30 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Asia/Thimbu');
-} else {
-       putenv("TZ=Asia/Thimbu");
-}
+date_default_timezone_set('Asia/Thimbu');
 $tStamp = mktime (17, 17, 17, 1, 6476, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Thursday", $tStamp);
@@ -30,11 +22,7 @@ print "wanted=Thursday            00:30:00\n\n";
 
 print "TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not
 appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Indian/Cocos');
-} else {
-       putenv("TZ=Indian/Cocos");
-}
+date_default_timezone_set('Indian/Cocos');
 $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 Thursday", $tStamp);
@@ -43,11 +31,7 @@ print "wanted=Thursday            00:00:00\n\n";
 
 print "TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does
 not appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Africa/Lubumbashi');
-} else {
-       putenv("TZ=Africa/Lubumbashi");
-}
+date_default_timezone_set('Africa/Lubumbashi');
 $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);
@@ -55,11 +39,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/Kashgar - Is it OK for this to be 3 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Asia/Kashgar');
-} else {
-       putenv("TZ=Asia/Kashgar");
-}
+date_default_timezone_set('Asia/Kashgar');
 $tStamp = mktime (17, 17, 17, 1, 3767, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Thursday", $tStamp);
@@ -68,11 +48,7 @@ print "wanted=Thursday            03:00:00\n\n";
 
 print "TZ=Indian/Christmas - Is it OK for this to be 7 AM?  Note: does
 not appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Indian/Christmas');
-} else {
-       putenv("TZ=Indian/Christmas");
-}
+date_default_timezone_set('Indian/Christmas');
 $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 Sunday", $tStamp);
@@ -80,11 +56,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/Santo_Domingo - Is it OK for this to be 0:30 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('America/Santo_Domingo');
-} else {
-       putenv("TZ=America/Santo_Domingo");
-}
+date_default_timezone_set('America/Santo_Domingo');
 $tStamp = mktime (17, 17, 17, 1, 291, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Sunday", $tStamp);
@@ -93,11 +65,7 @@ print "wanted=Sunday            00:30:00\n\n";
 
 print "TZ=Pacific/Truk - Is it OK for this to be 10 AM?  Note: does not
 appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Truk');
-} else {
-       putenv("TZ=Pacific/Truk");
-}
+date_default_timezone_set('Pacific/Truk');
 $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);
@@ -106,11 +74,7 @@ print "wanted=Tuesday            00:00:00\n\n";
 
 print "TZ=Pacific/Ponape - Is it OK for this to be 11 AM?  Note: does
 not appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Ponape');
-} else {
-       putenv("TZ=Pacific/Ponape");
-}
+date_default_timezone_set('Pacific/Ponape');
 $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);
@@ -118,11 +82,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/Scoresbysund - Is it OK for this to be 2 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('America/Scoresbysund');
-} else {
-       putenv("TZ=America/Scoresbysund");
-}
+date_default_timezone_set('America/Scoresbysund');
 $tStamp = mktime (17, 17, 17, 1, 4099, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Sunday", $tStamp);
@@ -130,11 +90,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
 print "wanted=Sunday            02:00:00\n\n";
 
 print "TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('America/Guyana');
-} else {
-       putenv("TZ=America/Guyana");
-}
+date_default_timezone_set('America/Guyana');
 $tStamp = mktime (17, 17, 17, 1, 2031, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Thursday", $tStamp);
@@ -142,11 +98,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
 print "wanted=Thursday            00:45:00\n\n";
 
 print "TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Asia/Tehran');
-} else {
-       putenv("TZ=Asia/Tehran");
-}
+date_default_timezone_set('Asia/Tehran');
 $tStamp = mktime (17, 17, 17, 1, 2855, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Tuesday", $tStamp);
@@ -155,11 +107,7 @@ print "wanted=Tuesday            00:30:00\n\n";
 
 print "TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does
 not appear to have a DST or timezone transition.\n";     
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Tarawa');
-} else {
-       putenv("TZ=Pacific/Tarawa");
-}
+date_default_timezone_set('Pacific/Tarawa');
 $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);
@@ -167,11 +115,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=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Africa/Monrovia');
-} else {
-       putenv("TZ=Africa/Monrovia");
-}
+date_default_timezone_set('Africa/Monrovia');
 $tStamp = mktime (17, 17, 17, 1, 845, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Monday", $tStamp);
@@ -179,11 +123,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
 print "wanted=Monday            00:44:30\n\n";
 
 print "TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Asia/Katmandu');
-} else {
-       putenv("TZ=Asia/Katmandu");
-}
+date_default_timezone_set('Asia/Katmandu');
 $tStamp = mktime (17, 17, 17, 1, 5838, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Wednesday", $tStamp);
@@ -191,11 +131,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
 print "wanted=Wednesday            00:15:00\n\n";         
 
 print "TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Nauru');
-} else {
-       putenv("TZ=Pacific/Nauru");
-}
+date_default_timezone_set('Pacific/Nauru');
 $tStamp = mktime (17, 17, 17, 1, 3401, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Tuesday", $tStamp);
@@ -203,11 +139,7 @@ print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
 print "wanted=Tuesday            00:30:00\n\n";
 
 print "TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Niue');
-} else {
-       putenv("TZ=Pacific/Niue");
-}
+date_default_timezone_set('Pacific/Niue');
 $tStamp = mktime (17, 17, 17, 1, 3189, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Sunday", $tStamp);
@@ -216,11 +148,7 @@ print "wanted=Sunday            00:30:00\n\n";
 
 print "TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST
 or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Port_Moresby');
-} else {
-       putenv("TZ=Pacific/Port_Moresby");
-}
+date_default_timezone_set('Pacific/Port_Moresby');
 $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 Thursday", $tStamp); 
@@ -228,11 +156,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/Miquelon - Is it OK for this to be 1 AM ? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('America/Miquelon');
-} else {
-       putenv("TZ=America/Miquelon");
-}
+date_default_timezone_set('America/Miquelon');
 $tStamp = mktime (17, 17, 17, 1, 3767, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Thursday", $tStamp);
@@ -241,11 +165,7 @@ print "wanted=Thursday            01:00:00\n\n";
 
 print "TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or
 timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Palau');
-} else {
-       putenv("TZ=Pacific/Palau");
-} 
+date_default_timezone_set('Pacific/Palau');
 $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);
@@ -254,11 +174,7 @@ print "wanted=Saturday            00:00:00\n\n";
 
 print "TZ=Pacific/Funafuti - Is it OK for this to be midday?  Note: does
 not appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Funafuti');
-} else {
-       putenv("TZ=Pacific/Funafuti");
-} 
+date_default_timezone_set('Pacific/Funafuti');
 $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);
@@ -267,11 +183,7 @@ print "wanted=Wednesday            00:00:00\n\n";
 
 print "TZ=Pacific/Wake - Is it OK for this to be midday?  Note: does not
 appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Wake');
-} else {
-       putenv("TZ=Pacific/Wake");
-} 
+date_default_timezone_set('Pacific/Wake');
 $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);
@@ -280,11 +192,7 @@ print "wanted=Tuesday            00:00:00\n\n";
 
 print "TZ=Pacific/Wallis - Is it OK for this to be midday?  Note: does
 not appear to have a DST or timezone transition.\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('Pacific/Wallis');
-} else {
-       putenv("TZ=Pacific/Wallis");
-} 
+date_default_timezone_set('Pacific/Wallis');
 $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);
@@ -292,11 +200,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/Paramaribo - Is it OK for this to be 0:30 AM? yes\n";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('America/Paramaribo');
-} else {
-       putenv("TZ=America/Paramaribo");
-} 
+date_default_timezone_set('America/Paramaribo');
 $tStamp = mktime (17, 17, 17, 1, 5381, 1970);
 print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
 $strtotime_tstamp = strtotime("next Monday", $tStamp);
index 089efb41545a6847ea8ebd574a53209d0f20a04c..12bc9f0fcefb1abd69196cd568cc6c970c6a6775 100644 (file)
@@ -3,22 +3,14 @@ date() function
 --FILE--
 <?php
 $tmp = "cr";
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set('GMT0');
-} else {
-       putenv ("TZ=GMT0");
-}
-
+date_default_timezone_set('UTC');
 
 for($a = 0;$a < strlen($tmp); $a++){
        echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
 }
 
-if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-       date_default_timezone_set("MET");
-} else {
-       putenv ("TZ=MET");
-}
+date_default_timezone_set("MET");
+
 for($a = 0;$a < strlen($tmp); $a++){
        echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n";
 }
index d8d95a03651b79050e67b631d9cd95d9dc8d5faf..5fa4192c171680f8e974323340155c6d6d4ac883 100644 (file)
@@ -9,8 +9,8 @@ date.timezone=
        echo date('e'), "\n";
 ?>
 --EXPECTF--
-Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-1.php on line 3
-%s
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 3
+UTC
 
-Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-1.php on line 4
-%s
+Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 4
+UTC
index bdef81b38d6b05892789d077d20f1a320b36a796..abf283575369570a4ab12f5886750e38080483dd 100644 (file)
@@ -8,5 +8,5 @@ date.timezone=
        echo date_default_timezone_get(), "\n";
 ?>
 --EXPECTF--
-Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected '%s' for '%s' instead in %sdate_default_timezone_get-2.php on line 3
-%s
+Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-2.php on line 3
+UTC
index c6a6daf7a8421d8cd4426b764a8df45dbcec4931..f5eea4f9596b4a9cc1568e4633d988492afafa72 100644 (file)
@@ -18,9 +18,9 @@ date.timezone=
        echo date(DATE_ISO8601, $date4), "\n";
 ?>
 --EXPECTF--
-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3
+Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 3
 
-Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4
+Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 4
 America/Indiana/Knox
 2005-01-12T03:00:00-0500
 2005-07-12T03:00:00-0500
index 5ba6bd6c16151d61b6ad80c8573329d09f5ddb21..931f6375594d658cea5e9f5a743dafe9e9b8ad37 100644 (file)
@@ -1,21 +1,17 @@
 --TEST--
 mktime() [2]
---SKIPIF--
-<?php
-if(defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip mktime uses system TZ on Windows and putenv TZ is not supported on Windows at runtime");
-?>
 --INI--
 error_reporting=2047
 --FILE--
 <?php
 $timezones = array(
-    'GMT0',
+    'UTC',
     'Europe/London'
 );
 
 foreach($timezones as $timezone)
 {
-    putenv('TZ='.$timezone);
+    date_default_timezone_set($timezone);
 
     /* status of daylight saving time unknown */
     var_dump(mktime(0, 0, 0, 1, 1, 2002));
index 2e6eec79d158be35727f1ffafb8bd603cd399ba1..c70d6456d048d32456e199873eddef6d89ac6b04 100644 (file)
@@ -4,19 +4,10 @@ timezone configuration [1]
 date.timezone=GMT
 --FILE--
 <?php
-       putenv('TZ=Europe/Oslo');
-       if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-               date_default_timezone_set('Europe/Oslo');
-       } else {
-               putenv('TZ=Europe/Oslo');
-       }
+       date_default_timezone_set('Europe/Oslo');
        echo strtotime("2005-06-18 22:15:44"), "\n";
 
-       if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
-               date_default_timezone_set('Europe/London');
-       } else {
-               putenv('TZ=Europe/London');
-       }
+       date_default_timezone_set('Europe/London');
        echo strtotime("2005-06-18 22:15:44"), "\n";
 
        date_default_timezone_set('Europe/Oslo');