From 125894d35d5d961ff34dc17134eaf21da73115b3 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Mon, 02 May 2011 12:05:02 -0400
Subject: [PATCH] Fix expression

---
 program/include/rcube_session.php |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/program/include/rcube_session.php b/program/include/rcube_session.php
index 3f1e1cc..d3da36f 100644
--- a/program/include/rcube_session.php
+++ b/program/include/rcube_session.php
@@ -77,7 +77,7 @@
           array($this, 'mc_read'),
           array($this, 'mc_write'),
           array($this, 'mc_destroy'),
-          array($this, 'rcube_gc'));
+          array($this, 'gc'));
       }
       else {
         raise_error(array('code' => 604, 'type' => 'db',
@@ -163,7 +163,7 @@
     $now = $this->db->fromunixtime((int)$ts);
 
     // use internal data from read() for fast requests (up to 0.5 sec.)
-    if ($key == $this->key && $ts - $this->start < 0.5) {
+    if ($key == $this->key && (!$this->vars || $ts - $this->start < 0.5)) {
       $oldvars = $this->vars;
     } else { // else read data again from DB
       $oldvars = $this->db_read($key);
@@ -190,11 +190,13 @@
         $key, base64_encode($vars), (string)$this->ip);
     }
 
-    $this->unsets = array();
     return true;
   }
 
 
+  /**
+   * Merge vars with old vars and apply unsets
+   */
   private function _fixvars($vars, $oldvars)
   {
     $ts = microtime(true);
@@ -287,7 +289,7 @@
     $ts = microtime(true);
 
     // use internal data for fast requests (up to 0.5 sec.)
-    if ($key == $this->key && $ts - $this->start < 0.5)
+    if ($key == $this->key && (!$this->vars || $ts - $this->start < 0.5))
       $oldvars = $this->vars;
     else // else read data again
       $oldvars = $this->mc_read($key);

--
Gitblit v1.9.1