From 0bd93f6f4d2d37b6f362997f64236871026252ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Pe=CC=81rez?= <jaime.perez@uninett.no>
Date: Mon, 15 Aug 2016 10:39:47 +0200
Subject: [PATCH] bugfix: Fix a bug in AuthMemCookie that prevented the cookie
 from being set.

This was due to incorrect use of the SimpleSAML_SessionHandler::setCookie() method to set the cookie, instead of SimpleSAML\Utils\HTTP::setCookie().
---
 lib/SimpleSAML/AuthMemCookie.php | 3 +--
 www/authmemcookie.php            | 5 +----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php
index ab69515ef..ef8a0773f 100644
--- a/lib/SimpleSAML/AuthMemCookie.php
+++ b/lib/SimpleSAML/AuthMemCookie.php
@@ -145,8 +145,7 @@ class SimpleSAML_AuthMemCookie
         $memcache->delete($sessionID);
 
         // delete the session cookie
-        $sessionHandler = SimpleSAML_SessionHandler::getSessionHandler();
-        $sessionHandler->setCookie($cookieName, null);
+        \SimpleSAML\Utils\HTTP::setCookie($cookieName, null);
     }
 
 
diff --git a/www/authmemcookie.php b/www/authmemcookie.php
index 77379f64d..a24b0556b 100644
--- a/www/authmemcookie.php
+++ b/www/authmemcookie.php
@@ -34,11 +34,8 @@ try {
 
     // generate session id and save it in a cookie
     $sessionID = SimpleSAML\Utils\Random::generateID();
-
     $cookieName = $amc->getCookieName();
-
-    $sessionHandler = SimpleSAML_SessionHandler::getSessionHandler();
-    $sessionHandler->setCookie($cookieName, $sessionID);
+    \SimpleSAML\Utils\HTTP::setCookie($cookieName, $sessionID);
 
     // generate the authentication information
     $attributes = $s->getAttributes();
-- 
GitLab