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;
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.
*
......@@ -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;
}
......
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