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

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#5962-mime-empty-stri…
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ public function getMime()
public function generateMessage($EOL = Mime::LINEEND)
{
if (!$this->isMultiPart()) {
if (empty($this->parts)) {
return '';
}
$part = current($this->parts);
$body = $part->getContent($EOL);
} else {
Expand Down
11 changes: 11 additions & 0 deletions test/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,15 @@ public function testNonMultipartMessageShouldNotRemovePartFromMessage()
$test = current($parts);
$this->assertSame($part, $test);
}

/**
* @group ZF2-5962
*/
public function testPassEmptyArrayIntoSetPartsShouldReturnEmptyString()
{
$mimeMessage = new Mime\Message();
$mimeMessage->setParts(array());

$this->assertEquals('', $mimeMessage->generateMessage());
}
}

0 comments on commit a90af82

Please sign in to comment.