Make WordPress Core

Ticket #39380: 39380.1.diff

File 39380.1.diff, 1.2 KB (added by rachelbaker, 8 years ago)

Slice the $data array after the wp_update_comment_data filter

  • src/wp-includes/comment.php

     
    21862186
    21872187        $comment_ID = $data['comment_ID'];
    21882188        $comment_post_ID = $data['comment_post_ID'];
    2189         $keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' );
    2190         $data = wp_array_slice_assoc( $data, $keys );
    21912189
    21922190        /**
    21932191         * Filters the comment data immediately before it is updated in the database.
     
    22022200         */
    22032201        $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );
    22042202
     2203        $keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' );
     2204        $data = wp_array_slice_assoc( $data, $keys );
     2205
    22052206        $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
    22062207
    22072208        clean_comment_cache( $comment_ID );