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

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Header/Subject.php
Original file line number Diff line number Diff line change
@@ -32,7 +32,8 @@ class Subject implements UnstructuredInterface
public static function fromString($headerLine)
{
$decodedLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
list($name, $value) = explode(': ', $decodedLine, 2);
list($name, $value) = explode(':', $decodedLine, 2);
$value = ltrim($value);

// check to ensure proper header type for this factory
if (strtolower($name) !== 'subject') {
7 changes: 7 additions & 0 deletions test/Header/SubjectTest.php
Original file line number Diff line number Diff line change
@@ -30,4 +30,11 @@ public function testHeaderFolding()
$test = $subject->getFieldValue(Header\HeaderInterface::FORMAT_ENCODED);
$this->assertEquals($expected, $test);
}

public function testAllowsEmptyValueWhenParsing()
{
$headerString = 'Subject:';
$subject = Header\Subject::fromString($headerString);
$this->assertEquals('', $subject->getFieldValue());
}
}

0 comments on commit de10d09

Please sign in to comment.