Skip to content

Commit 4d4d706

Browse files
committed
Merge branch '4.4' into 5.3
* 4.4: [Mime] Relaxing in-reply-to header validation
2 parents ea3ea82 + 3526a32 commit 4d4d706

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/Symfony/Component/Mime/Header/Headers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ final class Headers
3434
'cc' => MailboxListHeader::class,
3535
'bcc' => MailboxListHeader::class,
3636
'message-id' => IdentificationHeader::class,
37-
'in-reply-to' => IdentificationHeader::class,
38-
'references' => IdentificationHeader::class,
37+
'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 ...
38+
'references' => UnstructuredHeader::class, // ... `Message-ID`, even if that is no valid `msg-id`
3939
'return-path' => PathHeader::class,
4040
];
4141

src/Symfony/Component/Mime/Tests/Header/HeadersTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,20 @@ public function testToArray()
280280
], $headers->toArray());
281281
}
282282

283+
public function testInReplyToAcceptsNonIdentifierValues()
284+
{
285+
$headers = new Headers();
286+
$headers->addHeader('In-Reply-To', 'foobar');
287+
$this->assertEquals('foobar', $headers->get('In-Reply-To')->getBody());
288+
}
289+
290+
public function testReferencesAcceptsNonIdentifierValues()
291+
{
292+
$headers = new Headers();
293+
$headers->addHeader('References' , 'foobar');
294+
$this->assertEquals('foobar', $headers->get('References')->getBody());
295+
}
296+
283297
public function testHeaderBody()
284298
{
285299
$headers = new Headers();

0 commit comments

Comments
 (0)