Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit c3dd482

Browse files
committed
add test for zendframework#147 regression
1 parent ece418b commit c3dd482

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/AddressListTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,25 @@ public function testSemicolonSeparator()
144144
$this->assertTrue($addressList->has('[email protected]'));
145145
$this->assertTrue($addressList->has('[email protected]'));
146146
}
147+
148+
/**
149+
* If name-field is quoted with "", then ' inside it should not treated as terminator, but as value.
150+
*/
151+
public function testMixedQuotesInName() {
152+
$header = '"Bob O\'Reilly" <[email protected]>,[email protected]';
153+
154+
// In previous versions, this throws:
155+
// 'Bob O'Reilly <[email protected]>,blah' can not be matched against dot-atom format
156+
// hence the try/catch block, to allow finding the root cause.
157+
try {
158+
$to = Header\To::fromString('To:' . $header);
159+
} catch (InvalidArgumentException $e) {
160+
$this->fail('Header\To::fromString should not throw. Exception message: ' . $e->getMessage());
161+
}
162+
163+
$addressList = $to->getAddressList();
164+
$this->assertTrue($addressList->has('[email protected]'));
165+
$this->assertTrue($addressList->has('[email protected]'));
166+
$this->assertEquals("Bob O'Reilly", $addressList->get('[email protected]')->getName());
167+
}
147168
}

0 commit comments

Comments
 (0)