From f4245d6d8f7e8e283e1e172d2d01db13e85354cc Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Mon, 29 Oct 2012 14:05:11 +0000
Subject: [PATCH] SAML2_HTTPRedirect: Fix warning with value-less paramtere.

This patch fixes warnings from query strings like:

    http://.../endpoint.php?foo&bar=test

(Where the parameter "foo" doesn't have a value.)

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3197 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SAML2/HTTPRedirect.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/SAML2/HTTPRedirect.php b/lib/SAML2/HTTPRedirect.php
index 6033389a0..ddafea9d3 100644
--- a/lib/SAML2/HTTPRedirect.php
+++ b/lib/SAML2/HTTPRedirect.php
@@ -173,7 +173,14 @@ class SAML2_HTTPRedirect extends SAML2_Binding {
 		$relayState = '';
 		$sigAlg = '';
 		foreach (explode('&', $_SERVER['QUERY_STRING']) as $e) {
-			list($name, $value) = explode('=', $e, 2);
+			$tmp = explode('=', $e, 2);
+			$name = $tmp[0];
+			if (count($tmp) === 2) {
+				$value = $tmp[1];
+			} else {
+				/* No value for this paramter. */
+				$value = '';
+			}
 			$name = urldecode($name);
 			$data[$name] = urldecode($value);
 
-- 
GitLab