From 040c3b98a4e4dfec4bd349cde4a369116a3c125d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20P=C3=A9rez=20Crespo?= <jaime.perez@uninett.no> Date: Tue, 24 Sep 2019 10:44:56 +0200 Subject: [PATCH] Fix some logic mistakes in the Logger class The new `$initializing` property should signal that we are initializing the logging handler with a value of `true`, not the other way around. Also, it should only be set to `true` while we are actually initializing the logging handler. --- lib/SimpleSAML/Logger.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index 603343d96..0c1d542e3 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -398,9 +398,6 @@ class Logger register_shutdown_function([self::class, 'shutdown']); self::$shutdownRegistered = true; } - - // Set initializing to true > all went well! - self::$initializing = true; } @@ -411,6 +408,8 @@ class Logger */ private static function createLoggingHandler($handler = null) { + self::$initializing = true; + // a set of known logging handlers $known_handlers = [ 'syslog' => 'SimpleSAML\Logger\SyslogLoggingHandler', @@ -450,6 +449,8 @@ class Logger self::$format = $config->getString('logging.format', self::$format); self::$loggingHandler->setLogFormat(self::$format); + + self::$initializing = false; } @@ -461,7 +462,7 @@ class Logger */ private static function log($level, $string, $statsLog = false) { - if (self::$initializing === false) { + if (self::$initializing) { // some error occurred while initializing logging self::defer($level, $string, $statsLog); return; -- GitLab