[wp-trac] [WordPress Trac] #45374: apply_filters_ref_array() no longer passes arguments by reference

WordPress Trac noreply at wordpress.org
Mon Nov 19 10:58:35 UTC 2018


#45374: apply_filters_ref_array() no longer passes arguments by reference
--------------------------+------------------------------------------
 Reporter:  johnbillion   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  4.7
 Severity:  normal        |   Keywords:  needs-patch needs-unit-tests
  Focuses:                |
--------------------------+------------------------------------------
 It appears that since the introduction of the `WP_Hook` class in WordPress
 4.7 (#17817), `apply_filters_ref_array()` no longer passes its arguments
 by reference.

 Example:

 {{{
 add_filter( 'posts_clauses', function( $clauses, &$query ) {
         return $clauses;
 }, 10, 2 );
 }}}

 The above code will trigger the following PHP warning:

 {{{
 Parameter 2 to {closure}() expected to be a reference, value given
 }}}

 cc @jbrinley FYI

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45374>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list