[wp-trac] [WordPress Trac] #19015: do_action fails on nested calls

WordPress Trac wp-trac at lists.automattic.com
Thu Nov 3 21:25:05 UTC 2011


#19015: do_action fails on nested calls
--------------------------+------------------------------
 Reporter:  mrubiolvn     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Plugins       |     Version:  3.2.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by transom):

 This speaks to a situation I ran into today.

 A plugin using a construct similar to SergeyBiryukov (above) was causing
 my plugin (who had a lower priority tied to the same hook) to not execute.

 My theory is that since remove_action (and remove_filter) "unset" the
 element in the same array that do_action (do_action_ref_array, et al) are
 iterating over, the index shifts and whatever action is next in the list
 fails to execute.

 But interating over a copy of the current functions hooked would keep one
 from removing a function further down the priority list (if that was
 desired)

 The question becomes "which one is doing it wrong"?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19015#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list