Skip to content
Snippets Groups Projects
Commit 0b4413ac authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Bugfix: do not set the timezone as initialized if it wasn't!

parent 84371887
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,14 @@ use SimpleSAML\Logger; ...@@ -13,6 +13,14 @@ use SimpleSAML\Logger;
class Time 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. * This function generates a timestamp on the form used by the SAML protocols.
* *
...@@ -39,14 +47,10 @@ class Time ...@@ -39,14 +47,10 @@ class Time
*/ */
public static function initTimezone() public static function initTimezone()
{ {
static $initialized = false; if (self::$tz_initialized) {
if ($initialized) {
return; return;
} }
$initialized = true;
$globalConfig = \SimpleSAML_Configuration::getInstance(); $globalConfig = \SimpleSAML_Configuration::getInstance();
$timezone = $globalConfig->getString('timezone', null); $timezone = $globalConfig->getString('timezone', null);
...@@ -54,6 +58,7 @@ class Time ...@@ -54,6 +58,7 @@ class Time
if (!date_default_timezone_set($timezone)) { if (!date_default_timezone_set($timezone)) {
throw new \SimpleSAML_Error_Exception('Invalid timezone set in the "timezone" option in config.php.'); throw new \SimpleSAML_Error_Exception('Invalid timezone set in the "timezone" option in config.php.');
} }
self::$tz_initialized = true;
return; return;
} }
// we don't have a timezone configured // we don't have a timezone configured
...@@ -64,6 +69,7 @@ class Time ...@@ -64,6 +69,7 @@ class Time
// set the timezone to the default // set the timezone to the default
date_default_timezone_set($serverTimezone); date_default_timezone_set($serverTimezone);
self::$tz_initialized = true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment