-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat quote as value if already in quote using another delimiter
- Loading branch information
1 parent
d52d25b
commit 64e1af1
Showing
3 changed files
with
30 additions
and
0 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
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 |
---|---|---|
|
@@ -200,4 +200,26 @@ public function testKey() | |
$this->list->next(); | ||
$this->assertSame('[email protected]', $this->list->key()); | ||
} | ||
|
||
/** | ||
* If name-field is quoted with "", then ' inside it should not treated as terminator, but as value. | ||
*/ | ||
public function testMixedQuotesInName() | ||
{ | ||
$header = '"Bob O\'Reilly" <[email protected]>,[email protected]'; | ||
|
||
// In previous versions, this throws: | ||
// 'Bob O'Reilly <[email protected]>,blah' can not be matched against dot-atom format | ||
// hence the try/catch block, to allow finding the root cause. | ||
try { | ||
$to = Header\To::fromString('To:' . $header); | ||
} catch (InvalidArgumentException $e) { | ||
$this->fail('Header\To::fromString should not throw'); | ||
} | ||
|
||
$addressList = $to->getAddressList(); | ||
$this->assertTrue($addressList->has('[email protected]')); | ||
$this->assertTrue($addressList->has('[email protected]')); | ||
$this->assertEquals("Bob O'Reilly", $addressList->get('[email protected]')->getName()); | ||
} | ||
} |