From 4af76d20cafcd456bf3ce0fcb17b25a888c45160 Mon Sep 17 00:00:00 2001
From: Thomas <thomas@roundcube.net>
Date: Mon, 21 Oct 2013 15:14:46 -0400
Subject: [PATCH] Bump version

---
 program/lib/Roundcube/rcube_session.php |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/program/lib/Roundcube/rcube_session.php b/program/lib/Roundcube/rcube_session.php
index 82ff8a8..ee4db6e 100644
--- a/program/lib/Roundcube/rcube_session.php
+++ b/program/lib/Roundcube/rcube_session.php
@@ -203,10 +203,15 @@
             if (is_array($a_oldvars)) {
                 // remove unset keys on oldvars
                 foreach ((array)$this->unsets as $var) {
-                    $path = explode('.', $var);
-                    $k = array_pop($path);
-                    $node = &$this->get_node($path, $a_oldvars);
-                    unset($node[$k]);
+                    if (isset($a_oldvars[$var])) {
+                        unset($a_oldvars[$var]);
+                    }
+                    else {
+                        $path = explode('.', $var);
+                        $k = array_pop($path);
+                        $node = &$this->get_node($path, $a_oldvars);
+                        unset($node[$k]);
+                    }
                 }
 
                 $newvars = $this->serialize(array_merge(
@@ -305,9 +310,9 @@
 
         $newvars = $oldvars !== null ? $this->_fixvars($vars, $oldvars) : $vars;
 
-        if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 2) {
+        if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 3) {
             return $this->memcache->set($key, serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $newvars)),
-                MEMCACHE_COMPRESSED, $this->lifetime);
+                MEMCACHE_COMPRESSED, $this->lifetime + 60);
         }
 
         return true;
@@ -402,7 +407,7 @@
     /**
      * Unset a session variable
      *
-     * @param string Varibale name (can be a path denoting a certain node in the session array, e.g. compose.attachments.5)
+     * @param string Variable name (can be a path denoting a certain node in the session array, e.g. compose.attachments.5)
      * @return boolean True on success
      */
     public function remove($var=null)
@@ -413,10 +418,15 @@
 
         $this->unsets[] = $var;
 
-        $path = explode('.', $var);
-        $key = array_pop($path);
-        $node = &$this->get_node($path, $_SESSION);
-        unset($node[$key]);
+        if (isset($_SESSION[$var])) {
+            unset($_SESSION[$var]);
+        }
+        else {
+            $path = explode('.', $var);
+            $key = array_pop($path);
+            $node = &$this->get_node($path, $_SESSION);
+            unset($node[$key]);
+        }
 
         return true;
     }

--
Gitblit v1.9.1