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

WordPress Trac noreply at wordpress.org
Thu Dec 6 17:12:48 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                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+------------------------------

Comment (by henry.wright):

 To add to my last comment

 Related to example 1, if we prefix the array elements with `&`, we see
 `call_user_func_array()` doesn't cause problems: https://3v4l.org/ZfMrf

 @websupporter I think you are right to think the `$args[ 0 ] = $value;`
 assignment is the issue. After this point `$args[0]` is not a reference.
 Hence we get the warning shown in example 1.

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


More information about the wp-trac mailing list