[Pkg-owncloud-commits] [owncloud] 18/104: preserve 3rd party values in in the Session destructor

David Prévot taffit at moszumanska.debian.org
Sat Jan 18 13:33:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 148c16bf70ae08d078868692e08422d810d27de8
Author: Robin Appelman <icewind at owncloud.com>
Date:   Mon Dec 9 12:38:27 2013 +0100

    preserve 3rd party values in  in the Session destructor
---
 lib/private/session/internal.php | 11 ++++++++++-
 lib/private/session/memory.php   |  2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/private/session/internal.php b/lib/private/session/internal.php
index 60aeccc..49b52b5 100644
--- a/lib/private/session/internal.php
+++ b/lib/private/session/internal.php
@@ -26,10 +26,19 @@ class Internal extends Memory {
 	}
 
 	public function __destruct() {
-		$_SESSION = $this->data;
+		$_SESSION = array_merge($_SESSION, $this->data);
 		session_write_close();
 	}
 
+	/**
+	 * @param string $key
+	 */
+	public function remove($key) {
+		// also remove it from $_SESSION to prevent re-setting the old value during the merge
+		unset($_SESSION[$key]);
+		parent::remove($key);
+	}
+
 	public function clear() {
 		session_unset();
 		@session_regenerate_id(true);
diff --git a/lib/private/session/memory.php b/lib/private/session/memory.php
index c148ff4..134cee5 100644
--- a/lib/private/session/memory.php
+++ b/lib/private/session/memory.php
@@ -11,7 +11,7 @@ namespace OC\Session;
 /**
  * Class Internal
  *
- * store session data in an in-memory array, not persistance
+ * store session data in an in-memory array, not persistent
  *
  * @package OC\Session
  */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list