WordPress.org

Make WordPress Core

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

File next-to-each-r3.patch, 2.2 KB (added by devesine, 6 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                        $args[1] = $value;
    172172                        $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
    173173                }
    174         } while ( next($wp_filter[$tag]) !== false );
     174        }
    175175
    176176        array_pop( $wp_current_filter );
    177177
     
    222222
    223223        reset( $wp_filter[ $tag ] );
    224224
    225         do {
    226                 foreach( (array) current($wp_filter[$tag]) as $the_ ) {
     225        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     226                foreach( $next['value'] as $the_ ) {
    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
     
    399399
    400400        reset( $wp_filter[ $tag ] );
    401401
    402         do {
    403                 foreach ( (array) current($wp_filter[$tag]) as $the_ ) {
     402        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     403                foreach( $next['value'] as $the_ ) {
    404404                        call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
    405405                }
    406         } while ( next($wp_filter[$tag]) !== false );
     406        }
    407407
    408408        array_pop($wp_current_filter);
    409409}
     
    479479
    480480        reset( $wp_filter[ $tag ] );
    481481
    482         do {
    483                 foreach( (array) current($wp_filter[$tag]) as $the_ ) {
     482        while ( ( $next = each($wp_filter[$tag]) ) !== false ) {
     483                foreach( $next['value'] as $the_ ) {
    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}
     
    710710        global $wp_filter;
    711711
    712712        reset( $wp_filter['all'] );
    713         do {
    714                 foreach( (array) current($wp_filter['all']) as $the_ ) {
     713        while ( ( $next = each($wp_filter['all']) ) !== false ) {
     714                foreach( $next['value'] as $the_ ) {
    715715                        call_user_func_array($the_['function'], $args);
    716716                }
    717         } while ( next($wp_filter['all']) !== false );
     717        }
    718718}
    719719
    720720/**