From fca6170f619fc1a224bec3fe58380a539202cd74 Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Thu, 31 Mar 2016 12:25:22 +0200 Subject: [PATCH] It doesn't make any sense to use sessions while invoked from the command line. This resolves #353. --- lib/SimpleSAML/Session.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 592414190..6ab6834b7 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -139,6 +139,13 @@ class SimpleSAML_Session { $this->authData = array(); + if (php_sapi_name() === 'cli' || defined('STDIN')) { + $this->trackid = 'CL'.bin2hex(openssl_random_pseudo_bytes(4)); + SimpleSAML\Logger::setTrackId($this->trackid); + $this->transient = $transient; + return; + } + if ($transient) { // transient session $sh = SimpleSAML_SessionHandler::getSessionHandler(); $this->trackid = 'TR'.bin2hex(openssl_random_pseudo_bytes(4)); -- GitLab