[wp-trac] [WordPress Trac] #40397: PHP 7.1.x problem in WP_Query

WordPress Trac noreply at wordpress.org
Mon Apr 10 01:45:24 UTC 2017


#40397: PHP 7.1.x problem in WP_Query
--------------------------+------------------------------
 Reporter:  dglingren     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Query         |     Version:  4.7.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by dd32):

 > It looks like the WP_Query object is being passed to the filter by
 reference, not by value, so the filter can modify elements such as the
 query_vars array. The Codex documentation for apply_filters_ref_array
 includes:

 That's correct, however is a hold-over from PHP4 - in PHP5+ all object are
 passed by reference, regardless of if `&` is used.
 `apply_filters_ref_array()` and `do_action_ref_array()` are vestiges for
 that time.

 The `&` in the plugin was never needed - WordPress was passing a reference
 to the function already, there was no need for the plugin to specify that
 the incoming value should be treated a as a reference (effectively, it was
 saying, treat this reference as a reference to the reference).

 I don't think there's anything that core needs to do here - the plugin
 simply needs to update to remove the byref specifier.

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


More information about the wp-trac mailing list