From 224a58a9464eaf83b953b1a973b169ff222885af Mon Sep 17 00:00:00 2001 From: Krishnaprasad MG Date: Tue, 18 Dec 2018 12:51:01 +0100 Subject: [PATCH 1/3] Fix header type inconsistency --- src/Decode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Decode.php b/src/Decode.php index d4c181f..a104ce8 100644 --- a/src/Decode.php +++ b/src/Decode.php @@ -108,7 +108,7 @@ public static function splitMessage($message, &$headers, &$body, $EOL = Mime::LI $firstlinePos = strpos($message, "\n"); $firstline = $firstlinePos === false ? $message : substr($message, 0, $firstlinePos); if (! preg_match('%^[^\s]+[^:]*:%', $firstline)) { - $headers = []; + $headers = new Headers(); // TODO: we're ignoring \r for now - is this function fast enough and is it safe to assume noone needs \r? $body = str_replace(["\r", "\n"], ['', $EOL], $message); return; From a4b00388313af17898217f89ff28fcc914f13d65 Mon Sep 17 00:00:00 2001 From: webimpress Date: Wed, 16 Oct 2019 20:13:15 +0100 Subject: [PATCH 2/3] Add test to cover fix from #36 --- test/DecodeTest.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/DecodeTest.php diff --git a/test/DecodeTest.php b/test/DecodeTest.php new file mode 100644 index 0000000..ca52f93 --- /dev/null +++ b/test/DecodeTest.php @@ -0,0 +1,25 @@ + Date: Wed, 16 Oct 2019 20:16:59 +0100 Subject: [PATCH 3/3] Adds CHANGELOG entry for #36 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebf104f..6a1c2a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,10 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- Nothing. +- [#36](https://github.com/zendframework/zend-mime/pull/36) fixes + `Zend\Mime\Decode::splitMessage` to set `Zend\Mail\Headers` + instance always for `$headers` parameter. Before, when messages + without headers was provided, `$headers` was an empty array. ## 2.7.1 - 2018-05-14