Make WordPress Core

Changeset 20682 for trunk/wp-mail.php


Ignore:
Timestamp:
05/02/2012 01:32:19 PM (13 years ago)
Author:
nacin
Message:

Anchor a regular expression in wp-mail.php to ensure we are matching 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-mail.php

    r19712 r20682  
    106106            // Set the author using the email address (From or Reply-To, the last used)
    107107            // otherwise use the site admin
    108             if ( preg_match('/(From|Reply-To): /', $line) ) {
     108            if ( ! $author_found && preg_match( '/^(From|Reply-To): /', $line ) ) {
    109109                if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) )
    110110                    $author = $matches[0];
     
    115115                    echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
    116116                    $userdata = get_user_by('email', $author);
    117                     if ( empty($userdata) ) {
    118                         $author_found = false;
    119                     } else {
     117                    if ( ! empty( $userdata ) ) {
    120118                        $post_author = $userdata->ID;
    121119                        $author_found = true;
    122120                    }
    123                 } else {
    124                     $author_found = false;
    125121                }
    126122            }
Note: See TracChangeset for help on using the changeset viewer.