From 7df358d64ead7f8622d7efd2a8c2e6c3893ee706 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 19 Mar 2020 11:59:05 +0100 Subject: [PATCH] Fix internal cache use in rcube_imap::get_message() Two folders, personal and shared, can contain the same UIDs, so we should check UID and folder name when dealing with internally cached message. --- program/lib/Roundcube/rcube_imap.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index 27950b768..9d7ac714d 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -1900,8 +1900,11 @@ class rcube_imap extends rcube_storage } // Check internal cache - if (!empty($this->icache['message'])) { - if (($headers = $this->icache['message']) && $headers->uid == $uid) { + if (!empty($this->icache['message']) && ($headers = $this->icache['message'])) { + // Make sure the folder and UID is what we expect. + // In case when the same process works with folders that are personal + // and shared two folders can contain the same UIDs. + if ($headers->uid == $uid && $headers->folder == $folder) { return $headers; } }