[wp-trac] [WordPress Trac] #40393: Using remove_action within an action callback skips over execution of other callbacks with lower priority

WordPress Trac noreply at wordpress.org
Fri Jul 21 20:37:22 UTC 2017


#40393: Using remove_action within an action callback skips over execution of other
callbacks with lower priority
--------------------------+------------------------------
 Reporter:  weeblrpress   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Plugins       |     Version:
 Severity:  major         |  Resolution:
 Keywords:  dev-feedback  |     Focuses:
--------------------------+------------------------------

Comment (by jbrinley):

 `WP_Hook::resort_active_iterations()` appropriately handles inserting a
 filter into the array, but it looks like a bug slipped through for
 removing one.

 In the `while` loop, if it changes from

 {{{#!php
                         while ( current( $iteration ) < $current ) {
                                 if ( false === next( $iteration ) ) {
                                         break;
                                 }
                         }
 }}}

 to
 {{{#!php
                         while ( current( $iteration ) < $current ) {
                                 $next = next( $iteration );
                                 if ( $next > $current ) {
                                         // The current key has gone away.
 Point
                                         // to the previous key so it's
 grabbed
                                         // on the next iteration
                                         prev( $iteration );
                                         break;
                                 } elseif ( false === $next ) {
                                         break;
                                 }
                         }
 }}}

 it seems to resolve the issue. I've haven't run the full test suite
 against that yet to test for regressions.

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


More information about the wp-trac mailing list