From d77e08729b812333bc22680c4072a6e41f4ba40e Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 02 Jun 2013 05:57:37 -0400
Subject: [PATCH] Fix removing flags from serialized object before saving it in DB

---
 program/lib/Roundcube/rcube_imap_cache.php |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/program/lib/Roundcube/rcube_imap_cache.php b/program/lib/Roundcube/rcube_imap_cache.php
index 47d9aaf..089a524 100644
--- a/program/lib/Roundcube/rcube_imap_cache.php
+++ b/program/lib/Roundcube/rcube_imap_cache.php
@@ -407,8 +407,8 @@
             return;
         }
 
-        $msg   = serialize($this->db->encode(clone $message));
         $flags = 0;
+        $msg   = clone $message;
 
         if (!empty($message->flags)) {
             foreach ($this->flags as $idx => $flag) {
@@ -417,7 +417,9 @@
                 }
             }
         }
+
         unset($msg->flags);
+        $msg = serialize($this->db->encode($msg));
 
         // update cache record (even if it exists, the update
         // here will work as select, assume row exist if affected_rows=0)

--
Gitblit v1.9.1