diff options
author | Jaime Perez Crespo <jaime.perez@uninett.no> | 2016-03-04 14:33:30 +0100 |
---|---|---|
committer | Jaime Perez Crespo <jaime.perez@uninett.no> | 2016-03-04 14:33:30 +0100 |
commit | 0b4413ac0f3957625b32781cdff76eef3171d5f6 (patch) | |
tree | ad9a65d91a81b56f3a203df423899b3fc4d805e6 /lib/SimpleSAML | |
parent | 84371887a91c28bc1d394df2a80a8770a136d716 (diff) | |
download | simplesamlphp-0b4413ac0f3957625b32781cdff76eef3171d5f6.zip simplesamlphp-0b4413ac0f3957625b32781cdff76eef3171d5f6.tar.gz simplesamlphp-0b4413ac0f3957625b32781cdff76eef3171d5f6.tar.bz2 |
Bugfix: do not set the timezone as initialized if it wasn't!
Diffstat (limited to 'lib/SimpleSAML')
-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; } |