WordPress.org

Make WordPress Core

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

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

     
    163163        if ( empty($args) )
    164164                $args = func_get_args();
    165165
    166         do {
    167                 foreach( (array) current($wp_filter[$tag]) as $the_ )
     166        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     167                foreach( (array) $next['value'] as $the_ )
    168168                        if ( !is_null($the_['function']) ){
    169169                                $args[1] = $value;
    170170                                $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
    171171                        }
    172172
    173         } while ( next($wp_filter[$tag]) !== false );
     173        }
    174174
    175175        array_pop( $wp_current_filter );
    176176
     
    221221
    222222        reset( $wp_filter[ $tag ] );
    223223
    224         do {
    225                 foreach( (array) current($wp_filter[$tag]) as $the_ )
     224        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     225                foreach( (array) $next['value'] as $the_ )
    226226                        if ( !is_null($the_['function']) )
    227227                                $args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
    228228
    229         } while ( next($wp_filter[$tag]) !== false );
     229        }
    230230
    231231        array_pop( $wp_current_filter );
    232232
     
    397397
    398398        reset( $wp_filter[ $tag ] );
    399399
    400         do {
    401                 foreach ( (array) current($wp_filter[$tag]) as $the_ )
     400        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     401                foreach( (array) $next['value'] as $the_ )
    402402                        if ( !is_null($the_['function']) )
    403403                                call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
    404404
    405         } while ( next($wp_filter[$tag]) !== false );
     405        }
    406406
    407407        array_pop($wp_current_filter);
    408408}
     
    478478
    479479        reset( $wp_filter[ $tag ] );
    480480
    481         do {
    482                 foreach( (array) current($wp_filter[$tag]) as $the_ )
     481        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     482                foreach( (array) $next['value'] as $the_ )
    483483                        if ( !is_null($the_['function']) )
    484484                                call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
    485485
    486         } while ( next($wp_filter[$tag]) !== false );
     486        }
    487487
    488488        array_pop($wp_current_filter);
    489489}
     
    708708        global $wp_filter;
    709709
    710710        reset( $wp_filter['all'] );
    711         do {
    712                 foreach( (array) current($wp_filter['all']) as $the_ )
     711        while ( ( $next = each($wp_filter['all']) ) !== false ) {
     712                foreach( (array) $next['value'] as $the_ )
    713713                        if ( !is_null($the_['function']) )
    714714                                call_user_func_array($the_['function'], $args);
    715715
    716         } while ( next($wp_filter['all']) !== false );
     716        }
    717717}
    718718
    719719/**