From ff65cfcacf9e1d5fad7dd9a5553de97f2d3e0662 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 22 Oct 2019 00:11:03 +0000 Subject: [PATCH] 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 --- wp-includes/plugin.php | 3 +++ wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php index 3725292dcc..6e9de6c3f4 100644 --- a/wp-includes/plugin.php +++ b/wp-includes/plugin.php @@ -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 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 185c122831..25d503061c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.