Make WordPress Core

Changeset 33557


Ignore:
Timestamp:
08/03/2015 09:39:23 PM (9 years ago)
Author:
ocean90
Message:

Comments: IDs are integers.

Merge of [33555] to the 4.1 branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/src/wp-includes/post.php

    r30735 r33557  
    28892889    foreach ( $group_by_status as $status => $comments ) {
    28902890        // Sanity check. This shouldn't happen.
    2891         if ( 'post-trashed' == $status )
     2891        if ( 'post-trashed' == $status ) {
    28922892            $status = '0';
    2893         $comments_in = implode( "', '", $comments );
    2894         $wpdb->query( "UPDATE $wpdb->comments SET comment_approved = '$status' WHERE comment_ID IN ('" . $comments_in . "')" );
     2893        }
     2894        $comments_in = implode( ', ', array_map( 'intval', $comments ) );
     2895        $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) );
    28952896    }
    28962897
Note: See TracChangeset for help on using the changeset viewer.