From 313607ddc97a37c4be91e5722e8f0977c1b4a3e1 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Tue, 17 Jan 2017 17:11:48 +0200
Subject: [PATCH] Make sure not to add a second question mark to Shibboleth
 logout URL.

---
 module/VuFind/src/VuFind/Auth/Shibboleth.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/Auth/Shibboleth.php b/module/VuFind/src/VuFind/Auth/Shibboleth.php
index f872f781786..874e59e2ea8 100644
--- a/module/VuFind/src/VuFind/Auth/Shibboleth.php
+++ b/module/VuFind/src/VuFind/Auth/Shibboleth.php
@@ -211,7 +211,10 @@ class Shibboleth extends AbstractBase
         if (isset($config->Shibboleth->logout)
             && !empty($config->Shibboleth->logout)
         ) {
-            $url = $config->Shibboleth->logout . '?return=' . urlencode($url);
+            $append = (strpos($config->Shibboleth->logout, '?') !== false) ? '&'
+                : '?';
+            $url = $config->Shibboleth->logout . $append . 'return='
+                . urlencode($url);
         }
 
         // Send back the redirect URL (possibly modified):
-- 
GitLab