Parser fix - MimeMessages with CRLF caused iconv_mime_decode throwing Exceptions

This commit is contained in:
Petr Bechyně 2017-02-17 15:06:06 +01:00
parent a76526a5b6
commit 4edc46e67f

View File

@ -110,7 +110,8 @@ class Parser
}
if (strpos($currentHeader, ':') !== false) {
list($headerName, $headerValue) = explode(':', $currentHeader, 2);
$headerValue = iconv_mime_decode($headerValue, 0, Part::CHARSET_UTF8);
$headerValueWithNoCrAtTheEnd = trim($headerValue);
$headerValue = iconv_mime_decode($headerValueWithNoCrAtTheEnd, 0, Part::CHARSET_UTF8);
$parsedMimeHeaders = ContentTypeParser::parseContentTypeHeader($headerName, $headerValue);
foreach ($parsedMimeHeaders as $parsedMimeHeader) {
$currentPart->setHeader(