WordPress.org

Make WordPress Core

Ticket #21169: next-to-each-22075.patch

File next-to-each-22075.patch, 2.4 KB (added by devesine, 7 years ago)
  • wp-includes/plugin.php

     
    166166        if ( empty($args) )
    167167                $args = func_get_args();
    168168
    169         do {
    170                 foreach( (array) current($wp_filter[$tag]) as $the_ )
     169        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     170                foreach( $next['value'] as $the_ )
    171171                        if ( !is_null($the_['function']) ){
    172172                                $args[1] = $value;
    173173                                $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
    174174                        }
     175        }
    175176
    176         } while ( next($wp_filter[$tag]) !== false );
    177 
    178177        array_pop( $wp_current_filter );
    179178
    180179        return $value;
     
    224223
    225224        reset( $wp_filter[ $tag ] );
    226225
    227         do {
    228                 foreach( (array) current($wp_filter[$tag]) as $the_ )
     226        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     227                foreach( $next['value'] as $the_ )
    229228                        if ( !is_null($the_['function']) )
    230229                                $args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
     230        }
    231231
    232         } while ( next($wp_filter[$tag]) !== false );
    233 
    234232        array_pop( $wp_current_filter );
    235233
    236234        return $args[0];
     
    400398
    401399        reset( $wp_filter[ $tag ] );
    402400
    403         do {
    404                 foreach ( (array) current($wp_filter[$tag]) as $the_ )
     401        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     402                foreach( $next['value'] as $the_ )
    405403                        if ( !is_null($the_['function']) )
    406404                                call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
     405        }
    407406
    408         } while ( next($wp_filter[$tag]) !== false );
    409 
    410407        array_pop($wp_current_filter);
    411408}
    412409
     
    481478
    482479        reset( $wp_filter[ $tag ] );
    483480
    484         do {
    485                 foreach( (array) current($wp_filter[$tag]) as $the_ )
     481        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     482                foreach( $next['value'] as $the_ )
    486483                        if ( !is_null($the_['function']) )
    487484                                call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
     485        }
    488486
    489         } while ( next($wp_filter[$tag]) !== false );
    490 
    491487        array_pop($wp_current_filter);
    492488}
    493489
     
    713709        global $wp_filter;
    714710
    715711        reset( $wp_filter['all'] );
    716         do {
    717                 foreach( (array) current($wp_filter['all']) as $the_ )
     712        while ( ( $next = each($wp_filter['all']) ) !== false ) {
     713                foreach( $next['value'] as $the_ )
    718714                        if ( !is_null($the_['function']) )
    719715                                call_user_func_array($the_['function'], $args);
    720 
    721         } while ( next($wp_filter['all']) !== false );
     716        }
    722717}
    723718
    724719/**