Make WordPress Core

Changeset 28425


Ignore:
Timestamp:
05/15/2014 06:16:34 AM (12 years ago)
Author:
wonderboymusic
Message:

Eliminate the use of extract() in wp_mail(). Check the filtered array for each value before re-setting variables.

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pluggable.php

    r28424 r28425  
    234234         *                    subject, message, headers, and attachments values.
    235235         */
    236         extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
    237 
    238         if ( !is_array($attachments) )
     236        $atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
     237
     238        if ( isset( $atts['to'] ) ) {
     239                $to = $atts['to'];
     240        }
     241
     242        if ( isset( $atts['subject'] ) ) {
     243                $subject = $atts['subject'];
     244        }
     245
     246        if ( isset( $atts['message'] ) ) {
     247                $message = $atts['message'];
     248        }
     249
     250        if ( isset( $atts['headers'] ) ) {
     251                $headers = $atts['headers'];
     252        }
     253
     254        if ( isset( $atts['attachments'] ) ) {
     255                $attachments = $atts['attachments'];
     256        }
     257
     258        if ( ! is_array( $attachments ) ) {
    239259                $attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
    240 
     260        }
    241261        global $phpmailer;
    242262
Note: See TracChangeset for help on using the changeset viewer.