[wp-trac] [WordPress Trac] #29070: Calling remove_all_filters() causes has_filter() with no $function_to_check to always return true

WordPress Trac noreply at wordpress.org
Tue Aug 12 13:11:56 UTC 2014


#29070: Calling remove_all_filters() causes has_filter() with no $function_to_check
to always return true
--------------------------+-----------------------------
 Reporter:  pseudoxiah    |       Owner:  wonderboymusic
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  4.0
Component:  Plugins       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------------
Changes (by kovshenin):

 * keywords:  has-patch needs-testing => has-patch
 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 There's a problem with r29422. The new foreach loop resets the internal
 array counter which do_action() and apply_filters() rely on. This can
 cause infinite loops. Here's an example:

 {{{
 add_action( 'foo', '__return_null', 1 );
 add_action( 'foo', '__return_null', 2 );
 add_action( 'foo', '__return_null', 3 );
 add_action( 'foo', 'bar', 4 );

 function bar() {
     has_action( 'foo', 'something' );
 }

 do_action( 'foo' );
 }}}

 Patch in [attachment:29070.diff].

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


More information about the wp-trac mailing list