Upgrade/Install: Prevent removal of additional data from plugin update info.

This switches to using `wp_parse_args()` instead of a combination of `array_merge()` and `array_intersect_key()` when ensuring that all expected default keys are present in the update information for a plugin.

This prevents non-default data returned by 3rd-party plugins from being unintentionally stripped out.

Props peterwilsoncc, chriscct7.
Fixes #51609.
Built from https://develop.svn.wordpress.org/trunk@49477


git-svn-id: http://core.svn.wordpress.org/trunk@49236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2020-11-02 19:13:07 +00:00
parent 409bd27659
commit e3a467a55a
3 changed files with 3 additions and 3 deletions

View File

@ -974,7 +974,7 @@ class WP_Debug_Data {
'requires_php' => '', 'requires_php' => '',
'compatibility' => new stdClass(), 'compatibility' => new stdClass(),
); );
$item = array_merge( $item, array_intersect_key( $plugin, $item ) ); $item = wp_parse_args( $plugin, $item );
} }
$auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item ); $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item );

View File

@ -230,7 +230,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
'compatibility' => new stdClass(), 'compatibility' => new stdClass(),
); );
$filter_payload = (object) array_merge( $filter_payload, array_intersect_key( $plugin_data, $filter_payload ) ); $filter_payload = (object) wp_parse_args( $plugin_data, $filter_payload );
$auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, $filter_payload ); $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, $filter_payload );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6-beta2-49476'; $wp_version = '5.6-beta2-49477';
/** /**
* 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.