From 02399f1b2896a9c41ec43aae9b215c228bec7cde Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Wed, 18 Feb 2009 09:02:35 +0000
Subject: [PATCH] Session: Allow $id to getData to be NULL.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1286 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Session.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index b35bd96ed..808cb8b7a 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -760,12 +760,16 @@ class SimpleSAML_Session {
 	 * the data should be written back with setData.
 	 *
 	 * @param $type  The type of the data. This must match the type used when adding the data.
-	 * @param $id    The identifier of the data.
+	 * @param $id    The identifier of the data. Can be NULL, in which case NULL will be returned.
 	 * @return The data of the given type with the given id or NULL if the data doesn't exist in the data store.
 	 */
 	public function getData($type, $id) {
-		assert(is_string($type));
-		assert(is_string($id));
+		assert('is_string($type)');
+		assert('$id === NULL || is_string($id)');
+
+		if($id === NULL) {
+			return NULL;
+		}
 
 		$this->expireData();
 
-- 
GitLab