diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
index 5de407f615..742561c184 100644
--- a/src/wp-admin/includes/dashboard.php
+++ b/src/wp-admin/includes/dashboard.php
@@ -1058,7 +1058,8 @@ function wp_dashboard_recent_comments( $total_items = 5 ) {
 		$comments_query['status'] = 'approve';
 	}
 
-	while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
+	$comment_count = count( $comments );
+	while ( $comment_count < $total_items && $possible = get_comments( $comments_query ) ) {
 		if ( ! is_array( $possible ) ) {
 			break;
 		}
