Make WordPress Core


Ignore:
Timestamp:
09/09/2020 03:53:50 AM (4 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Remove unnecessary reference sign from get_comment() definition.

This fixes a PHP 8 "argument must be passed by reference, value given" error when using array_map( 'get_comment', ... ).

Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around.

Note: This reverts [48838], which is now redundant.

Follow-up to a similar change for get_post() in [21572].

See #50913.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-comment-query.php

    r48838 r48961  
    482482
    483483        // Convert to WP_Comment instances.
    484         array_walk( $_comments, 'get_comment' );
    485         $comments = $_comments;
     484        $comments = array_map( 'get_comment', $_comments );
    486485
    487486        if ( $this->query_vars['hierarchical'] ) {
Note: See TracChangeset for help on using the changeset viewer.