Skip to content

Commit

Permalink
Anchor a regular expression in wp-mail.php to ensure we are matching …
Browse files Browse the repository at this point in the history
…the Reply-To: header, not the In-Reply-To: header.

Per RFCs *822, mail headers must start at the beginning of a line. This same pattern could be continued throughout this file.

props solarissmoke.
fixes #18923.



git-svn-id: http://core.svn.wordpress.org/trunk@20682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed May 2, 2012
1 parent 5a37c2f commit 95ab5d3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions wp-mail.php
Expand Up @@ -105,7 +105,7 @@

// Set the author using the email address (From or Reply-To, the last used)
// otherwise use the site admin
if ( preg_match('/(From|Reply-To): /', $line) ) {
if ( ! $author_found && preg_match( '/^(From|Reply-To): /', $line ) ) {
if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) )
$author = $matches[0];
else
Expand All @@ -114,14 +114,10 @@
if ( is_email($author) ) {
echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
$userdata = get_user_by('email', $author);
if ( empty($userdata) ) {
$author_found = false;
} else {
if ( ! empty( $userdata ) ) {
$post_author = $userdata->ID;
$author_found = true;
}
} else {
$author_found = false;
}
}

Expand Down

0 comments on commit 95ab5d3

Please sign in to comment.