From cb4657bb45963689eda81a928e994314652a6bc9 Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 16 May 2008 06:55:45 +0000
Subject: [PATCH] Session: Change getData to not update the expire-time of data
 which is accessed.

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

diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index 57bf19995..003c3db73 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -527,6 +527,10 @@ class SimpleSAML_Session {
 
 	/**
 	 * This function removes expired data from the data store.
+	 *
+	 * Note that this function doesn't mark the session object as dirty. This means that
+	 * if the only change to the session object is that some data has expired, it will not be
+	 * written back to the session store.
 	 */
 	private function expireData() {
 
@@ -604,6 +608,9 @@ class SimpleSAML_Session {
 	/**
 	 * This function retrieves data from the data store.
 	 *
+	 * Note that this will not change when the data stored in the data store will expire. If that is required,
+	 * 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.
 	 * @return The data of the given type with the given id or NULL if the data doesn't exist in the data store.
@@ -626,12 +633,7 @@ class SimpleSAML_Session {
 			return NULL;
 		}
 
-		$dataInfo =& $this->dataStore[$type][$id];
-		$dataInfo['expires'] = time() + $dataInfo['timeout'];
-
-		$this->dirty = TRUE;
-
-		return $dataInfo['data'];
+		return $this->dataStore[$type][$id]['data'];
 	}
 
 
-- 
GitLab