You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #47225 [Mime] Re-allow addIdHeader to be used for 'In-Reply-To' and 'References' headers (AlbinoDrought)
This PR was merged into the 6.2 branch.
Discussion
----------
[Mime] Re-allow addIdHeader to be used for 'In-Reply-To' and 'References' headers
| Q | A
| ------------- | ---
| Branch? | 6.2
| Bug fix? | no (arguable: undo BC break)
| New feature? | yes (arguable: undo BC break)
| Deprecations? | no
| Tickets | Fix#45097
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
#44732 causes messages using `addIdHeader('In-Reply-To', ...)` or `addIdHeader('References', ...)` to fail the headers check (see #44732 (comment) ), requiring users to manually format the header value themselves.
This PR re-allows the previous behaviour of `addIdHeader` while keeping the new unstructured behaviour in-place as the default.
-----
(I'm not sure if this counts as a new feature or a bug fix since it "reintroduces" a previous feature)
Commits
-------
ffde0f1 [Mime] Re-allow addIdHeader to be used for 'In-Reply-To' and 'References' headers
Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Header/Headers.php
+21-5Lines changed: 21 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -34,8 +34,8 @@ final class Headers
34
34
'cc' => MailboxListHeader::class,
35
35
'bcc' => MailboxListHeader::class,
36
36
'message-id' => 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`
37
+
'in-reply-to' => [UnstructuredHeader::class, IdentificationHeader::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, IdentificationHeader::class], // ... `Message-ID`, even if that is no valid `msg-id`
39
39
'return-path' => PathHeader::class,
40
40
];
41
41
@@ -137,7 +137,11 @@ public function addParameterizedHeader(string $name, string $value, array $param
if (($c = self::HEADER_CLASS_MAP[$name] ?? null) && !$headerinstanceof$c) {
225
-
thrownewLogicException(sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), $c, get_debug_type($header)));
236
+
foreach ($headerClassesas$c) {
237
+
if ($headerinstanceof$c) {
238
+
return;
239
+
}
226
240
}
241
+
242
+
thrownewLogicException(sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), implode('" or "', $headerClasses), get_debug_type($header)));
0 commit comments