From 01209e2fc8d0876e7d824771d459fdf00f7558db Mon Sep 17 00:00:00 2001
From: kioan <kioan20@hotmail.com>
Date: Tue, 13 May 2014 13:49:55 +0300
Subject: [PATCH] Update class.mailparse.php function splitHeaders

function splitHeaders updated in order to correctly parse mail header lines
starting with tabs
---
 include/class.mailparse.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index d498a77f7..8cc91d0de 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -140,8 +140,8 @@ class Mail_Parse {
     /* static */ function splitHeaders($headers_text, $as_array=false) {
         $headers = preg_split("/\r?\n/", $headers_text);
         for ($i=0, $k=count($headers); $i<$k; $i++) {
-            # XXX: Might tabs be used here?
-            if (substr($headers[$i], 0, 1) == " ") {
+            // first char might be whitespace (" " or "\t")
+            if (in_array($headers[$i][0], array(" ", "\t"))) {
                 # Continuation from previous header (runon to next line)
                 $j=$i-1; while (!isset($headers[$j]) && $j>0) $j--;
                 $headers[$j] .= " ".ltrim($headers[$i]);
-- 
GitLab