This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix AddressList toString method to quote semicolon
- Loading branch information
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
use Exception as GeneralException; | ||
use PHPUnit\Framework\TestCase; | ||
use Zend\Mail\Exception as MailException; | ||
use Zend\Mail\Headers; | ||
use Zend\Mail\Storage; | ||
use Zend\Mail\Storage\Exception; | ||
use Zend\Mail\Storage\Message; | ||
|
@@ -24,6 +25,7 @@ | |
class MessageTest extends TestCase | ||
{ | ||
protected $file; | ||
|
||
protected $file2; | ||
|
||
public function setUp() | ||
|
@@ -432,6 +434,29 @@ public function testSpaceInFieldName() | |
$this->assertEquals(Mime\Decode::splitHeaderField($header, 'baz'), 42); | ||
} | ||
|
||
/** | ||
* splitMessage with Headers as input fails to process AddressList with semicolons | ||
*/ | ||
public function testHeadersLosesNameQuoting() | ||
{ | ||
$headerList = [ | ||
'From: "Famous bearings |;" <[email protected]>', | ||
'Reply-To: "Famous bearings |:" <[email protected]>', | ||
]; | ||
|
||
// create Headers object from array | ||
Mime\Decode::splitMessage(implode("\r\n", $headerList), $headers1, $body); | ||
$this->assertInstanceOf(Headers::class, $headers1); | ||
// create Headers object from Headers object | ||
Mime\Decode::splitMessage($headers1, $headers2, $body); | ||
$this->assertInstanceOf(Headers::class, $headers2); | ||
|
||
// test that same problem does not happen with Storage\Message internally | ||
$message = new Message(['headers' => $headers2, 'content' => (string)$body]); | ||
$this->assertEquals('"Famous bearings |;" <[email protected]>', $message->from); | ||
$this->assertEquals('Famous bearings |: <[email protected]>', $message->replyTo); | ||
} | ||
|
||
/** | ||
* @group ZF2-372 | ||
*/ | ||
|