From 17b21b6bcbcbaf506c3b216a301450b644a245a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Mon, 11 May 2009 09:55:07 +0000
Subject: [PATCH] Patch by Thomas Graff: Handling invalid casing of true and
 false in authrequest

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1500 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/XML/SAML20/AuthnRequest.php | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/SimpleSAML/XML/SAML20/AuthnRequest.php b/lib/SimpleSAML/XML/SAML20/AuthnRequest.php
index bbef2dd6f..d7bf991be 100644
--- a/lib/SimpleSAML/XML/SAML20/AuthnRequest.php
+++ b/lib/SimpleSAML/XML/SAML20/AuthnRequest.php
@@ -142,9 +142,9 @@ class SimpleSAML_XML_SAML20_AuthnRequest {
 		try{
 			return $this->isSamlBoolTrue($ispas);
 		}catch(Exception $e){
-			// ... I don't understand, default to false
-			return FALSE;
-			// throw new Exception('Invalid value of IsPassive attribute in SAML2 AuthnRequest.');
+			// ... I don't understand ...
+			// return FALSE;
+			throw new Exception('Invalid value of IsPassive attribute in SAML2 AuthnRequest.');
 		}
 	}
 
@@ -171,9 +171,9 @@ class SimpleSAML_XML_SAML20_AuthnRequest {
 		try{
 			return $this->isSamlBoolTrue($fa);
 		} catch(Exception $e){
-			// ... I don't understand, default to false
-			return FALSE;
-			// throw new Exception('Invalid value of ForceAuthn attribute in SAML2 AuthnRequest.');
+			// ... I don't understand ...
+			// return FALSE;
+			throw new Exception('Invalid value of ForceAuthn attribute in SAML2 AuthnRequest.');
 		}
 	}
 
@@ -308,6 +308,7 @@ class SimpleSAML_XML_SAML20_AuthnRequest {
 	 * @return bool TRUE or FALSE
 	 */
 	private function isSamlBoolTrue($boolSaml){
+		$boolSaml = strtolower($boolSaml);
 		if($boolSaml === 'true' || $boolSaml === '1') {
 			return TRUE;
 		} elseif($boolSaml === 'false' || $boolSaml === '0') {
-- 
GitLab