Make WordPress Core


Ignore:
Timestamp:
05/25/2015 05:58:52 PM (9 years ago)
Author:
wonderboymusic
Message:

get_comments() can return int, so a few places need to check if the return value is traversable before passing what is assumed to be an array.

See #32444.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r32591 r32600  
    31973197            $number = absint($struct['number']);
    31983198
    3199         $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
     3199        $comments = get_comments( array( 'status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
    32003200
    32013201        $comments_struct = array();
    3202 
    3203         foreach ( $comments as $comment ) {
    3204             $comments_struct[] = $this->_prepare_comment( $comment );
     3202        if ( is_array( $comments ) ) {
     3203            foreach ( $comments as $comment ) {
     3204                $comments_struct[] = $this->_prepare_comment( $comment );
     3205            }
    32053206        }
    32063207
Note: See TracChangeset for help on using the changeset viewer.