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.
Built from https://develop.svn.wordpress.org/trunk@46149


git-svn-id: http://core.svn.wordpress.org/trunk@45961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-16 14:48:54 +00:00
parent dc305e9e0a
commit a86711e28e
2 changed files with 8 additions and 10 deletions

View File

@ -448,10 +448,11 @@ function do_action( $tag, $arg = '' ) {
++$wp_actions[ $tag ]; ++$wp_actions[ $tag ];
} }
$all_args = func_get_args();
// Do 'all' actions first // Do 'all' actions first
if ( isset( $wp_filter['all'] ) ) { if ( isset( $wp_filter['all'] ) ) {
$wp_current_filter[] = $tag; $wp_current_filter[] = $tag;
$all_args = func_get_args();
_wp_call_all_hook( $all_args ); _wp_call_all_hook( $all_args );
} }
@ -466,14 +467,11 @@ function do_action( $tag, $arg = '' ) {
$wp_current_filter[] = $tag; $wp_current_filter[] = $tag;
} }
$args = array(); $args = $all_args;
if ( is_array( $arg ) && 1 == count( $arg ) && isset( $arg[0] ) && is_object( $arg[0] ) ) { // array(&$this) array_shift( $args );
$args[] =& $arg[0];
} else { if ( empty( $args ) ) {
$args[] = $arg; $args = array( '' );
}
for ( $a = 2, $num = func_num_args(); $a < $num; $a++ ) {
$args[] = func_get_arg( $a );
} }
$wp_filter[ $tag ]->do_action( $args ); $wp_filter[ $tag ]->do_action( $args );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46148'; $wp_version = '5.3-alpha-46149';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.