Skip to content

Commit

Permalink
PHP 8: fix fatal "argument must be passed by reference, value given"
Browse files Browse the repository at this point in the history
This fixes the following unit test failures:
```
1) Tests_Admin_includesListTable::test_filter_button_should_be_shown_if_there_are_comments

get_comment(): Argument #1 ($comment) must be passed by reference, value given

2) Tests_Admin_includesListTable::test_filter_comment_status_dropdown_should_be_shown_if_there_are_comments

get_comment(): Argument #1 ($comment) must be passed by reference, value given

14) WP_Test_Block_Render::test_render_latest_comments_on_password_protected_post

get_comment(): Argument #1 ($comment) must be passed by reference, value given
```
  • Loading branch information
jrfnl committed Aug 11, 2020
1 parent 29182f4 commit c554823
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wp-includes/class-wp-comment-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ public function get_comments() {
$_comments = apply_filters_ref_array( 'the_comments', array( $_comments, &$this ) );

// Convert to WP_Comment instances.
$comments = array_map( 'get_comment', $_comments );
array_walk( $_comments, 'get_comment' );
$comments = $_comments;

if ( $this->query_vars['hierarchical'] ) {
$comments = $this->fill_descendants( $comments );
Expand Down

0 comments on commit c554823

Please sign in to comment.