Skip to content

Commit

Permalink
[Mime] Relaxing in-reply-to header validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLandauer authored and fabpot committed Dec 21, 2021
1 parent 278b953 commit 0fcbdf2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Header/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ public function add(HeaderInterface $header): self
'cc' => MailboxListHeader::class,
'bcc' => MailboxListHeader::class,
'message-id' => IdentificationHeader::class,
'in-reply-to' => IdentificationHeader::class,
'references' => IdentificationHeader::class,
'in-reply-to' => UnstructuredHeader::class, // `In-Reply-To` and `References` are less strict than RFC 2822 (3.6.4) to allow users entering the original email's ...
'references' => UnstructuredHeader::class, // ... `Message-ID`, even if that is no valid `msg-id`
'return-path' => PathHeader::class,
];

Expand Down
14 changes: 14 additions & 0 deletions Tests/Header/HeadersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,18 @@ public function testToArray()
"Foo: =?utf-8?Q?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?=\r\n =?utf-8?Q?aaaa?=",
], $headers->toArray());
}

public function testInReplyToAcceptsNonIdentifierValues()
{
$headers = new Headers();
$headers->addHeader('In-Reply-To', 'foobar');
$this->assertEquals('foobar', $headers->get('In-Reply-To')->getBody());
}

public function testReferencesAcceptsNonIdentifierValues()
{
$headers = new Headers();
$headers->addHeader('References' , 'foobar');
$this->assertEquals('foobar', $headers->get('References')->getBody());
}
}

0 comments on commit 0fcbdf2

Please sign in to comment.