zend-mail icon indicating copy to clipboard operation
zend-mail copied to clipboard

Fix AddressList toString method to quote semicolon

Open glensc opened this issue 6 years ago • 4 comments

Certain input of AddressList headers, cannot be converted to string and back to header object because of incorrect quoting:

From: "Foo;" <[email protected]>

gets incorrectly converted as

From: Foo; <[email protected]>

but ; is address separator, so it needs to be quoted:

From: "Foo;" <[email protected]>

The problem I discovered internally when using Storage\Message with Headers input, therefore testing that method is included in the unit test:

$message = new Message(['headers' => new Headers(), 'content' => (string)$body]);

// Mime\Decode::splitMessage calls toString on headers object which creates invalid result:
if ($message instanceof Headers) {
    $message = $message->toString();
}

glensc avatar Jul 06 '19 02:07 glensc

@weierophinney, @Xerkus can you take care of this?

glensc avatar Jul 06 '19 02:07 glensc

this is a regression from #147 as it added ; separator support that's why (i believe) this exception is caught.

however, there should not be an assumption that only zend-mail is used for reading writing mail messages.

glensc avatar Jul 06 '19 02:07 glensc

This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at https://github.com/laminas/laminas-mail/issues/14.

weierophinney avatar Dec 31 '19 21:12 weierophinney

This repository has been moved to laminas/laminas-mail. If you feel that this patch is still relevant, please re-open against that repository, and reference this issue. To re-open, we suggest the following workflow:

  • Squash all commits in your branch (git rebase -i origin/{branch})
  • Make a note of all changed files (`git diff --name-only origin/{branch}...HEAD
  • Run the laminas/laminas-migration tool on the code.
  • Clone laminas/laminas-mail to another directory.
  • Copy the files from the second bullet point to the clone of laminas/laminas-mail.
  • In your clone of laminas/laminas-mail, commit the files, push to your fork, and open the new PR. We will be providing tooling via laminas/laminas-migration soon to help automate the process.

weierophinney avatar Dec 31 '19 21:12 weierophinney