Skip to content
Snippets Groups Projects
Commit 01209e2f authored by kioan's avatar kioan Committed by Jared Hancock
Browse files

Update class.mailparse.php function splitHeaders

function splitHeaders updated in order to correctly parse mail header lines
starting with tabs
parent cd7358a9
Branches
Tags
No related merge requests found
...@@ -140,8 +140,8 @@ class Mail_Parse { ...@@ -140,8 +140,8 @@ class Mail_Parse {
/* static */ function splitHeaders($headers_text, $as_array=false) { /* static */ function splitHeaders($headers_text, $as_array=false) {
$headers = preg_split("/\r?\n/", $headers_text); $headers = preg_split("/\r?\n/", $headers_text);
for ($i=0, $k=count($headers); $i<$k; $i++) { for ($i=0, $k=count($headers); $i<$k; $i++) {
# XXX: Might tabs be used here? // first char might be whitespace (" " or "\t")
if (substr($headers[$i], 0, 1) == " ") { if (in_array($headers[$i][0], array(" ", "\t"))) {
# Continuation from previous header (runon to next line) # Continuation from previous header (runon to next line)
$j=$i-1; while (!isset($headers[$j]) && $j>0) $j--; $j=$i-1; while (!isset($headers[$j]) && $j>0) $j--;
$headers[$j] .= " ".ltrim($headers[$i]); $headers[$j] .= " ".ltrim($headers[$i]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment