Make WordPress Core

Changeset 33558


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

Comments: IDs are integers.

Merge of [33555] to the 4.0 branch.

File:
1 edited

Legend:

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

    r30258 r33558  
    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.