From 8d57e8b0966930d002613227ac4ba24aed128cd6 Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Fri, 20 May 2016 13:51:35 +0200
Subject: [PATCH] Fix an issue with the SimpleSAML\Logger class that was still
 trying to fetch the track ID from the session when running from the command
 line, where there's obviously no session at all.

---
 lib/SimpleSAML/Logger.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php
index c5f433e91..9c408e61a 100644
--- a/lib/SimpleSAML/Logger.php
+++ b/lib/SimpleSAML/Logger.php
@@ -399,6 +399,9 @@ class Logger
                 self::createLoggingHandler('SimpleSAML\Logger\StandardErrorLoggingHandler');
             }
             $_SERVER['REMOTE_ADDR'] = "CLI";
+            if (self::$trackid == self::NO_TRACKID) {
+                self::$trackid = 'CL'.bin2hex(openssl_random_pseudo_bytes(4));
+            }
         } elseif (self::$loggingHandler === null) {
             // Initialize logging
             self::createLoggingHandler();
-- 
GitLab