diff options
Diffstat (limited to 'lib/SimpleSAML/Utils/Time.php')
-rw-r--r-- | lib/SimpleSAML/Utils/Time.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/SimpleSAML/Utils/Time.php b/lib/SimpleSAML/Utils/Time.php index 66d8a4e..3eebe50 100644 --- a/lib/SimpleSAML/Utils/Time.php +++ b/lib/SimpleSAML/Utils/Time.php @@ -14,6 +14,14 @@ class Time { /** + * Whether the timezone has been initialized or not. + * + * @var bool + */ + private static $tz_initialized = false; + + + /** * This function generates a timestamp on the form used by the SAML protocols. * * @param int $instant The time the timestamp should represent. Defaults to current time. @@ -39,14 +47,10 @@ class Time */ public static function initTimezone() { - static $initialized = false; - - if ($initialized) { + if (self::$tz_initialized) { return; } - $initialized = true; - $globalConfig = \SimpleSAML_Configuration::getInstance(); $timezone = $globalConfig->getString('timezone', null); @@ -54,6 +58,7 @@ class Time if (!date_default_timezone_set($timezone)) { throw new \SimpleSAML_Error_Exception('Invalid timezone set in the "timezone" option in config.php.'); } + self::$tz_initialized = true; return; } // we don't have a timezone configured @@ -64,6 +69,7 @@ class Time // set the timezone to the default date_default_timezone_set($serverTimezone); + self::$tz_initialized = true; } |