Index: Date/TimeZone.php =================================================================== RCS file: /repository/pear/Date/Date/TimeZone.php,v retrieving revision 1.11 diff -u -p -r1.11 TimeZone.php --- Date/TimeZone.php 15 Nov 2005 00:16:40 -0000 1.11 +++ Date/TimeZone.php 30 Jan 2006 23:16:54 -0000 @@ -248,10 +248,9 @@ class Date_TimeZone * Attempts to determine if a given Date object represents a date/time * that is in DST for this time zone. WARNINGS: this basically attempts to * "trick" the system into telling us if we're in DST for a given time zone. - * This uses putenv() which may not work in safe mode, and relies on unix time - * which is only valid for dates from 1970 to ~2038. This relies on the - * underlying OS calls, so it may not work on Windows or on a system where - * zoneinfo is not installed or configured properly. + * This relies on unix time which is only valid for dates from 1970 to ~2038. + * This relies on the underlying OS calls, so it may not work on Windows or + * on a system where zoneinfo is not installed or configured properly. * * @access public * @param object Date $date the date/time to test @@ -259,13 +258,10 @@ class Date_TimeZone */ function inDaylightTime($date) { - $env_tz = ""; - if(getenv("TZ")) { - $env_tz = getenv("TZ"); - } - putenv("TZ=".$this->id); + $default_tz = date_default_timezone_get(); + date_default_timezone_set($this->id); $ltime = localtime($date->getTime(), true); - putenv("TZ=".$env_tz); + date_default_timezone_set($default_tz); return $ltime['tm_isdst']; } @@ -4635,6 +4631,8 @@ if(isset($_DATE_TIMEZONE_DEFAULT) && Date_TimeZone::isValidID($_DATE_TIMEZONE_DEFAULT) ) { Date_TimeZone::setDefault($_DATE_TIMEZONE_DEFAULT); +} elseif (Date_TimeZone::isValidID(date_default_timezone_get())) { + Date_TimeZone::setDefault(date_default_timezone_get()); } elseif (getenv('PHP_TZ') && Date_TimeZone::isValidID(getenv('PHP_TZ'))) { Date_TimeZone::setDefault(getenv('PHP_TZ')); } elseif (getenv('TZ') && Date_TimeZone::isValidID(getenv('TZ'))) {