From d755eade08a562c34669280f855f7f0178081f61 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sat, 29 Jan 2011 09:27:00 -0500
Subject: [PATCH] Check mime headers before attempt to parse them (#1487745); broken since r4421

---
 CHANGELOG                      |    2 ++
 program/include/rcube_imap.php |    6 +++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index c2cc3c6..cfd6fd5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Check mime headers before attempt to parse them (#1487745)
+- Quote header values in show_additional_headers plugin (#1487744)
 - Fix settings UI on IE 6 (#1487724)
 - Remove double borders in folder listing (#1487713)
 - Separate full message headers UI element from headers table (#1487715)
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index cab232d..a4e67e1 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2238,7 +2238,11 @@
                 $mime_headers = $this->conn->fetchPartHeader(
                     $this->mailbox, $this->_msg_id, false, $struct->mime_id);
             }
-            $struct->headers = $this->_parse_headers($mime_headers) + $struct->headers;
+
+            if (is_string($mime_headers))
+                $struct->headers = $this->_parse_headers($mime_headers) + $struct->headers;
+            else if (is_object($mime_headers))
+                $struct->headers = get_object_vars($mime_headers) + $struct->headers;
 
             // get real content-type of message/rfc822
             if ($struct->mimetype == 'message/rfc822') {

--
Gitblit v1.9.1