[wp-trac] [WordPress Trac] #4625: apply_filters is broken

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 12 22:42:10 GMT 2007


#4625: apply_filters is broken
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:  anonymous
     Type:  defect             |      Status:  new      
 Priority:  highest omg bbq    |   Milestone:  2.2.2    
Component:  General            |     Version:  2.2.1    
 Severity:  normal             |    Keywords:           
-------------------------------+--------------------------------------------
 should be:


 {{{
         foreach ( $wp_filter[$tag] as $filter ) {
                 foreach( (array) $filter as $the_ )
                         if ( !is_null($the_['function']) ){
                                 $args[1] = $string;
                                 $string =
 call_user_func_array($the_['function'], array_slice($args, 1, (int)
 $the_['accepted_args']));
                         }
         }

 }}}

 because if you use remove_filter() at some point, you can end up with an
 empty array on $wp_filters[$tag]. using while ( next($wp_filters[$tag]) )
 at that point ends up ignoring a whole batch of applicable filters.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4625>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list