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. git-svn-id: https://develop.svn.wordpress.org/trunk@48961 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f6f117a0a9
commit
875acd7b37
@ -481,8 +481,7 @@ class WP_Comment_Query {
|
||||
$_comments = apply_filters_ref_array( 'the_comments', array( $_comments, &$this ) );
|
||||
|
||||
// Convert to WP_Comment instances.
|
||||
array_walk( $_comments, 'get_comment' );
|
||||
$comments = $_comments;
|
||||
$comments = array_map( 'get_comment', $_comments );
|
||||
|
||||
if ( $this->query_vars['hierarchical'] ) {
|
||||
$comments = $this->fill_descendants( $comments );
|
||||
|
@ -192,7 +192,7 @@ function get_approved_comments( $post_id, $args = array() ) {
|
||||
* respectively. Default OBJECT.
|
||||
* @return WP_Comment|array|null Depends on $output value.
|
||||
*/
|
||||
function get_comment( &$comment = null, $output = OBJECT ) {
|
||||
function get_comment( $comment = null, $output = OBJECT ) {
|
||||
if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) {
|
||||
$comment = $GLOBALS['comment'];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user