]> source.dussan.org Git - nextcloud-server.git/commitdiff
preserve 3rd party values in in the Session destructor
authorRobin Appelman <icewind@owncloud.com>
Mon, 9 Dec 2013 11:38:27 +0000 (12:38 +0100)
committerRobin Appelman <icewind@owncloud.com>
Mon, 9 Dec 2013 11:38:27 +0000 (12:38 +0100)
lib/private/session/internal.php
lib/private/session/memory.php

index 60aecccc8aac255ec08fb7f83cf4b572160c6fe9..49b52b5c796ec85b9ed93a4e9c4d128fa9f2a0cf 100644 (file)
@@ -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);
index c148ff4b9b9928af848b7895e9132ce02ea73bd0..134cee582eda34c7bfc67f2b834d3a6081751aed 100644 (file)
@@ -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
  */