Plugins: Restore backward compatibility for PHP4-style passing of array( &$this ) as action argument to do_action().

This is a follow-up to [46149] to avoid unnecessary breakage in case of using the old notation.

Props david.binda, jrf.
Reviewed by azaozz.
Fixes #48312.
Built from https://develop.svn.wordpress.org/trunk@46568


git-svn-id: http://core.svn.wordpress.org/trunk@46365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-10-22 00:11:03 +00:00
parent b37a2b5c3b
commit ff65cfcacf
2 changed files with 4 additions and 1 deletions

View File

@ -470,6 +470,9 @@ function do_action( $tag, ...$arg ) {
if ( empty( $arg ) ) {
$arg[] = '';
} elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) {
// Backward compatibility for PHP4-style passing of `array( &$this )` as action `$arg`.
$arg[0] = $arg[0][0];
}
$wp_filter[ $tag ]->do_action( $arg );

View File

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