Skip to content

Commit f6fced8

Browse files
committed
Comments: in WP_Comment_Query::fill_descendants(), compute count() in the first for expression so that it does not run on each iteration.
Props vishalkakadiya, deremohan. Fixes #37416. git-svn-id: https://develop.svn.wordpress.org/trunk@38297 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 081e51d commit f6fced8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/wp-includes/class-wp-comment-query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ protected function fill_descendants( $comments ) {
10121012

10131013
// Prime comment caches for non-top-level comments.
10141014
$descendant_ids = array();
1015-
for ( $i = 1; $i < count( $levels ); $i++ ) {
1015+
for ( $i = 1, $c = count( $levels ); $i <= $c; $i++ ) {
10161016
$descendant_ids = array_merge( $descendant_ids, $levels[ $i ] );
10171017
}
10181018

0 commit comments

Comments
 (0)