Ticket #3116: 3116b.diff

File 3116b.diff, 1.0 kB (added by mdawaffe, 2 years ago)

func_get_arg() NOT func_get_args()

  • wp-includes/plugin.php

    old new  
    102102 
    103103function do_action($tag, $arg = '') { 
    104104        global $wp_filter; 
    105         $extra_args = array_slice(func_get_args(), 2); 
    106         if ( is_array($arg) ) 
    107                 $args = array_merge($arg, $extra_args); 
    108         else 
    109                 $args = array_merge(array($arg), $extra_args); 
     105        $args = array($arg); 
     106        for ( $a = 2; $a < func_num_args(); $a++ ) 
     107                $args[] = func_get_arg($a); 
    110108 
    111109        merge_filters($tag); 
    112110 
     
    120118                                $function_name = $function['function']; 
    121119                                $accepted_args = $function['accepted_args']; 
    122120 
    123                                 if ( $accepted_args == 1 ) { 
    124                                         if ( is_array($arg) ) 
    125                                                 $the_args = $arg; 
    126                                         else 
    127                                                 $the_args = array($arg); 
    128                                 } elseif ( $accepted_args > 1 ) { 
     121                                if ( $accepted_args > 0 ) { 
    129122                                        $the_args = array_slice($args, 0, $accepted_args); 
    130123                                } elseif ( $accepted_args == 0 ) { 
    131124                                        $the_args = NULL;