[wp-trac] [WordPress Trac] #28473: wp_mail incorrectly parses multiline From header
WordPress Trac
noreply at wordpress.org
Sun Aug 3 00:03:26 UTC 2025
#28473: wp_mail incorrectly parses multiline From header
-------------------------------------------------+-------------------------
Reporter: arty.name | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Mail | Version: 3.9.1
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests changes- | Focuses:
requested |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* keywords: has-patch needs-testing has-unit-tests => has-patch has-unit-
tests changes-requested
Comment:
First, this patch is missing a part:
[https://datatracker.ietf.org/doc/html/rfc5322#section-2.2.3 According to
RFC 5322] lines could start by any WSP character which also includes an
horizontal tab
{{{
( ' ' === $tempheaders[ $index ][0] || "\t" === $tempheaders[ $index ][0]
) )
}}}
Also instead of checking for the array value itself, I would check if its
`isset` like
{{{
if ( $index > 0 && isset( $tempheaders[ $index ] ) && ( ' ' ===
$tempheaders[ $index ][0] || "\t" === $tempheaders[ $index ][0] ) ) {
}}}
Second, apart from this, I don't love that iterator. Instead of exploding
the $headers first, and then running this, we could do both actions in the
same run. I would have chosen a `foreach` because it's more visual.
With this review, I'm looking forward to seeing those changes in code. The
unit test refresh looks good.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28473#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list