[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 23:02:42 UTC 2016


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

Comment (by dd32):

 Replying to [comment:231 boonebgorges]:
 > I can confirm that there's an issue here. `tests_add_filter()` still
 works OK before WP has loaded - `WP_Hook::build_preinitialized_hooks()`
 takes care of the manually-set `$wp_filter` keys. But if you run
 `tests_add_filter()` after these pre-bootstrap filters are normalized,
 they never get converted to `WP_Hook` objects. [attachment:17817.25.diff]
 is a simple fix, though the `class_exists()` check might break once
 `WP_Hook` is autoloaded; we may want a global flag or a constant or
 somesuch to keep track of whether preexisting hooks have been converted.

 Once @jorbin's [attachment:17817.26.diff] is in, can't
 [attachment:17817.25.diff] just be a check on `function_exists(
 'add_filter' )` and use the API when available, falling back to directly
 modifying when it's called before initialisation?

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


More information about the wp-trac mailing list