From 6213c6a6e18848d861f2add83bdb69a1de3f5956 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 02 Jun 2013 05:55:46 -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 748474a..89e3ceb 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