mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Code Modernization: Fix PHP 8 "argument must be passed by reference, value given" error in WP_Comment_Query::get_comments()
.
The WP native `get_comment()` function expects the first argument `$comment` to be passed by reference. The PHP `array_map()` function, however, passes by value, not by reference, resulting in an "arguments must be passed by reference, value given" error. The PHP native `array_walk()` function does pass by reference. Using this prevents the error on PHP 8 and maintains the existing behaviour on PHP < 8. Props jrf. See #50913. Built from https://develop.svn.wordpress.org/trunk@48838 git-svn-id: http://core.svn.wordpress.org/trunk@48600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6766375f84
commit
7ba8aa2bb4
@ -481,7 +481,8 @@ class WP_Comment_Query {
|
||||
$_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 );
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-alpha-48837';
|
||||
$wp_version = '5.6-alpha-48838';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user