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

Commit

Permalink
Merge pull request zendframework/zendframework#2142 from padraic/test…
Browse files Browse the repository at this point in the history
…/PR-2122

Patch+Test for PR-2122: Fix extra values extraction from ContentType header (Zend\Mail)
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Header/ContentType.php
Expand Up @@ -48,7 +48,7 @@ public static function fromString($headerLine)

if (count($values)) {
foreach ($values as $keyValuePair) {
list($key, $value) = explode('=', $keyValuePair);
list($key, $value) = explode('=', $keyValuePair, 2);
$value = trim($value, "'\" \t\n\r\0\x0B");
$header->addParameter($key, $value);
}
Expand Down
9 changes: 9 additions & 0 deletions test/Header/ContentTypeTest.php
Expand Up @@ -59,5 +59,14 @@ public function testProvidingParametersIntroducesHeaderFolding()
$this->assertContains(";\r\n charset=\"us-ascii\"", $string);
}

public function testExtractsExtraInformationFromContentType()
{
$contentTypeHeader = ContentType::fromString(
'Content-Type: multipart/alternative; boundary="Apple-Mail=_1B852F10-F9C6-463D-AADD-CD503A5428DD"'
);
$params = $contentTypeHeader->getParameters();
$this->assertEquals($params,array('boundary' => 'Apple-Mail=_1B852F10-F9C6-463D-AADD-CD503A5428DD'));
}

}

0 comments on commit eb7f4fc

Please sign in to comment.