[wp-trac] [WordPress Trac] #50913: PHP 8.0: various compatibility fixes

WordPress Trac noreply at wordpress.org
Fri Aug 21 21:33:04 UTC 2020


#50913: PHP 8.0: various compatibility fixes
----------------------------+-------------------------------
 Reporter:  jrf             |       Owner:  SergeyBiryukov
     Type:  task (blessed)  |      Status:  reviewing
 Priority:  normal          |   Milestone:  5.6
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  php8 has-patch  |     Focuses:  coding-standards
----------------------------+-------------------------------

Comment (by SergeyBiryukov):

 In [changeset:"48838" 48838]:
 {{{
 #!CommitTicketReference repository="" revision="48838"
 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.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50913#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list