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.

git-svn-id: https://develop.svn.wordpress.org/trunk@49477 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2020-11-02 19:11:32 +00:00
parent 9d356ed8d9
commit d936f9ffe6
2 changed files with 2 additions and 2 deletions

View File

@ -974,7 +974,7 @@ class WP_Debug_Data {
'requires_php' => '',
'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 );

View File

@ -230,7 +230,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
'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 );