[wp-trac] [WordPress Trac] #17817: do_action/apply_filters/etc. recursion on same filter kills underlying call

WordPress Trac noreply at wordpress.org
Thu Sep 8 15:51:26 UTC 2016


#17817: do_action/apply_filters/etc. recursion on same filter kills underlying call
----------------------------------------------------+---------------------
 Reporter:  kernfel                                 |       Owner:  pento
     Type:  defect (bug)                            |      Status:  closed
 Priority:  normal                                  |   Milestone:  4.7
Component:  Plugins                                 |     Version:  2.2
 Severity:  normal                                  |  Resolution:  fixed
 Keywords:  has-patch needs-testing has-unit-tests  |     Focuses:
----------------------------------------------------+---------------------

Comment (by nerrad):

 Here's the code I see for `tests_add_filter`:

 {{{
 // For adding hooks before loading WP
 function tests_add_filter($tag, $function_to_add, $priority = 10,
 $accepted_args = 1) {
         global $wp_filter;

         $idx = _test_filter_build_unique_id($tag, $function_to_add,
 $priority);
         $wp_filter[$tag][$priority][$idx] = array('function' =>
 $function_to_add, 'accepted_args' => $accepted_args);
         return true;
 }
 }}}

 All we have in our tests is implementation of that filter in our plugin
 unit tests bootstrap.  So basically we do something like:

 `tests_add_filter( 'some_filter_we_want_to_hook_into', '__return_false' )`

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


More information about the wp-trac mailing list