ZF-3115: Zend_Mime_Decode::splitHeaderField doesn't work for some headers

Issue Type: Bug Created: 2008-04-15T13:52:55.000+0000 Last Updated: 2008-09-02T10:39:28.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Radoslaw Zawartko (radzaw) Assignee: Nico Edtinger (nico) Tags: - Zend_Mime

Related issues: Attachments:


It's not a normal bug, but rather problem with client application which sends bad mail headers (with additional spaces).

The problem is in class Zend_Mime_Decode, in method splitHeaderField, which returns empty string for header key, which is formated with additional spaces. This bug affect Zend_Mail_Part class so I cannot get message parts.

Sample headers (x-mailer: Microsoft Office Outlook, Build 11.0.5510) - additional space after "boundary":

content-type: multipart/mixed; boundary ="_NextPart_000_3798.1087"

Possible solution :

<pre class="highlight"> 
--- Decode.php  2008-04-15 21:24:18.606926208 +0200
+++ Decode-changed.php       2008-04-15 21:24:23.654158912 +0200
@@ -199,6 +199,7 @@

         if ($wantedPart) {
             foreach ($matches[1] as $key => $name) {
+                $name = trim($name);
                 if (strcasecmp($name, $wantedPart)) {

or modify regular expression in preg_match_all


Posted by Wil Sinclair (wil) on 2008-04-18T15:57:39.000+0000

Please evaluate and categorize/assign as necessary.

Posted by Nico Edtinger (nico) on 2008-04-22T12:41:45.000+0000

The space after the parameter name doesn't seem to be a valid character and I couldn't find a mail doing that (maybe it was spam?). But as it's invalid we can safely ignore it and it's now eaten by the regex.

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:28.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.