|
10 | 10 |
|
11 | 11 | use Exception as GeneralException;
|
12 | 12 | use Laminas\Mail\Exception as MailException;
|
| 13 | +use Laminas\Mail\Headers; |
13 | 14 | use Laminas\Mail\Storage;
|
14 | 15 | use Laminas\Mail\Storage\Exception;
|
15 | 16 | use Laminas\Mail\Storage\Message;
|
@@ -433,6 +434,31 @@ public function testSpaceInFieldName()
|
433 | 434 | $this->assertEquals(Mime\Decode::splitHeaderField($header, 'baz'), 42);
|
434 | 435 | }
|
435 | 436 |
|
| 437 | + /** |
| 438 | + * splitMessage with Headers as input fails to process AddressList with semicolons |
| 439 | + * |
| 440 | + * @see https://github.com/laminas/laminas-mail/pull/93 |
| 441 | + */ |
| 442 | + public function testHeadersLosesNameQuoting() |
| 443 | + { |
| 444 | + $headerList = [ |
| 445 | + 'From: "Famous bearings |;" <[email protected]>', |
| 446 | + 'Reply-To: "Famous bearings |:" <[email protected]>', |
| 447 | + ]; |
| 448 | + |
| 449 | + // create Headers object from array |
| 450 | + Mime\Decode::splitMessage(implode("\r\n", $headerList), $headers1, $body); |
| 451 | + $this->assertInstanceOf(Headers::class, $headers1); |
| 452 | + // create Headers object from Headers object |
| 453 | + Mime\Decode::splitMessage($headers1, $headers2, $body); |
| 454 | + $this->assertInstanceOf(Headers::class, $headers2); |
| 455 | + |
| 456 | + // test that same problem does not happen with Storage\Message internally |
| 457 | + $message = new Message(['headers' => $headers2, 'content' => (string)$body]); |
| 458 | + $this-> assertEquals( '"Famous bearings |;" <[email protected]>', $message-> from); |
| 459 | + $this-> assertEquals( 'Famous bearings |: <[email protected]>', $message-> replyTo); |
| 460 | + } |
| 461 | + |
436 | 462 | /**
|
437 | 463 | * @group Laminas-372
|
438 | 464 | */
|
|
0 commit comments