[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 21:08:08 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                                          |
-------------------------------------------------+-------------------------
Changes (by boonebgorges):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Replying to [comment:226 nerrad]:
 > So we were getting failing unit tests in our builds after this was
 deployed and so far it looks like it traces to our usage of the
 `tests_add_filter()` function found in `/tests/phpunit/functions.php`.
 That function overrides `$wp_filter` and doesn't implement the new
 changes.

 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.

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


More information about the wp-trac mailing list