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.


git-svn-id: https://develop.svn.wordpress.org/trunk@32600 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-05-25 17:58:52 +00:00
parent 768115d353
commit bd06ad2725
4 changed files with 20 additions and 16 deletions
+1 -1
View File
@@ -1009,7 +1009,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
}
$output .= '<ul id="recentcomments">';
if ( $comments ) {
if ( is_array( $comments ) && $comments ) {
// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
$post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
_prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );