Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

"Malformed header detected" on valid example from rfc7103 7.3 #92

@ftzdomino

Description

@ftzdomino

Per RFC 7103 section 7.3, having whitespace on an otherwise empty line is deprecated but still valid. I'm running into this with emails generated by some Microsoft product.

Code to reproduce the error:

require __DIR__.'/vendor/autoload.php';

$src = "From: user@example.com
To: userpal@example.net
Subject: This is your reminder

  about the football game tonight
Date: Wed, 20 Oct 2010 20:53:35 -0400

Don't forget to meet us for the tailgate party!
";
new Zend\Mail\Storage\Message(array('raw' => $src));

This results in:

PHP Fatal error:  Uncaught exception 'Zend\Mail\Exception\RuntimeException' with message 'Malformed header detected' in vendor/zendframework/zend-mail/src/Headers.php:88
vendor/zendframework/zend-mail/src/Headers.php:88
vendor/zendframework/zend-mime/src/Decode.php:142
vendor/zendframework/zend-mail/src/Storage/Part.php:105
vendor/zendframework/zend-mail/src/Storage/Message.php:54

One workaround is to use pipe the message source through formail first and tell it to merge header lines:
formail -c -f

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions