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
+3
View File
@@ -766,6 +766,9 @@ function wp_dashboard_recent_comments( $total_items = 5 ) {
$comments_query['status'] = 'approve';
while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
if ( ! is_array( $possible ) ) {
break;
}
foreach ( $possible as $comment ) {
if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) )
continue;