Make WordPress Core


Ignore:
Timestamp:
09/16/2019 02:47:53 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Code Modernisation: Remove redundant PHP 4 code from do_action().

As of PHP 5, objects are always passed by reference, so this has not been needed for quite some time.

Props jrf.
See #47678.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/plugin.php

    r46146 r46149  
    449449        }
    450450
     451        $all_args = func_get_args();
     452
    451453        // Do 'all' actions first
    452454        if ( isset( $wp_filter['all'] ) ) {
    453455                $wp_current_filter[] = $tag;
    454                 $all_args            = func_get_args();
    455456                _wp_call_all_hook( $all_args );
    456457        }
     
    467468        }
    468469
    469         $args = array();
    470         if ( is_array( $arg ) && 1 == count( $arg ) && isset( $arg[0] ) && is_object( $arg[0] ) ) { // array(&$this)
    471                 $args[] =& $arg[0];
    472         } else {
    473                 $args[] = $arg;
    474         }
    475         for ( $a = 2, $num = func_num_args(); $a < $num; $a++ ) {
    476                 $args[] = func_get_arg( $a );
     470        $args = $all_args;
     471        array_shift( $args );
     472
     473        if ( empty( $args ) ) {
     474                $args = array( '' );
    477475        }
    478476
Note: See TracChangeset for help on using the changeset viewer.