[wp-trac] [WordPress Trac] #17817: do_action/apply_filters/etc. recursion on same filter kills underlying call
WordPress Trac
noreply at wordpress.org
Sat Sep 3 13:28:11 UTC 2016
#17817: do_action/apply_filters/etc. recursion on same filter kills underlying call
-------------------------------------------------+-------------------------
Reporter: kernfel | Owner: pento
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 4.7
Component: Plugins | Version: 2.2
Severity: normal | Resolution:
Keywords: has-patch needs-testing has-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Comment (by pento):
Ah, I see what's happening.
* p11 removes itself, and so `::resort_active_iterations()` causes the
current `$this->iterations` to skip forward to priority 12.
* p11 re-adds itself, but now the current priority in `$this->iterations`
is 12, so `::resort_active_iterations()` doesn't go backwards.
* When `::apply_filters()` finishes priority 11, it assumes that the
current `$this->iterations` hasn't changed, so it grabs the next priority
(after 12).
[attachment:17817.17.diff] alters `::resort_active_iterations()`, to
detect when a new priority level has been created, that matches the
current priority according to `::apply_filters()`, and moves the current
`$this->iterations` back to that priority level.
@noplanman: Could you test [attachment:17817.17.diff]?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17817#comment:198>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list