From f2ee9fedce599670a38c8d253f96665d1b2fdcd4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Pe=CC=81rez?= <jaime.perez@uninett.no>
Date: Thu, 7 Jul 2016 16:12:12 +0200
Subject: [PATCH] Revert the change of the signature of
 SimpleSAML_Session::useTransientSession(). Not needed after all.

---
 lib/SimpleSAML/Session.php | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index 2ffd0e77d..a5f831b6c 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -205,8 +205,15 @@ class SimpleSAML_Session
              * session here. Therefore, use just a transient session and throw the exception for someone else to handle
              * it.
              */
-            self::useTransientSession($e);
             SimpleSAML\Logger::error('Error loading session: '.$e->getMessage());
+            self::useTransientSession();
+            if ($e instanceof SimpleSAML_Error_Exception) {
+                $cause = $e->getCause();
+                if ($cause instanceof Exception) {
+                    throw $cause;
+                }
+            }
+            throw $e;
         }
 
         // if getSession() found it, use it
@@ -339,13 +346,8 @@ class SimpleSAML_Session
      *
      * Create a session that should not be saved at the end of the request.
      * Subsequent calls to getInstance() will return this transient session.
-     *
-     * @param Exception|null $exception An exception that made us use a transient session. Specify if you want to log a
-     * message and that exception being thrown after loading the transient session.
-     *
-     * @throws * The exception contained in the $exception parameter, if any.
      */
-    public static function useTransientSession($exception = null)
+    public static function useTransientSession()
     {
         if (isset(self::$instance)) {
             // we already have a session, don't bother with a transient session
@@ -353,16 +355,6 @@ class SimpleSAML_Session
         }
 
         self::load(new SimpleSAML_Session(true));
-
-        if ($exception instanceof Exception) {
-            if ($exception instanceof SimpleSAML_Error_Exception) {
-                $cause = $exception->getCause();
-                if ($cause instanceof Exception) {
-                    throw $cause;
-                }
-            }
-            throw $exception;
-        }
     }
 
     /**
-- 
GitLab