Plugin Dependencies: Don't assume API response has a `slug` property.

Previously, `WP_Plugin_Dependencies::get_dependency_api_data()` attempted to set an array key using the `slug` property returned in a Plugins API response. However, the Plugins API response is filterable and may not contain a `slug` property.

Earlier in the method, a local `$slug` variable is used as a key for the same array.

For safety and consistency, this replaces array key references to `$information->slug` with `$slug`.

Follow-up to [57545].

Props pbiron, afragen, swissspidy, costdev.
Fixes #60540.
Built from https://develop.svn.wordpress.org/trunk@57736


git-svn-id: http://core.svn.wordpress.org/trunk@57237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
costdev 2024-02-28 18:04:09 +00:00
parent 542c23092d
commit e21be71af2
2 changed files with 2 additions and 2 deletions

View File

@ -694,7 +694,7 @@ class WP_Plugin_Dependencies {
self::$dependency_api_data[ $slug ] = (array) $information;
// plugins_api() returns 'name' not 'Name'.
self::$dependency_api_data[ $information->slug ]['Name'] = self::$dependency_api_data[ $information->slug ]['name'];
self::$dependency_api_data[ $slug ]['Name'] = self::$dependency_api_data[ $slug ]['name'];
set_site_transient( 'wp_plugin_dependencies_plugin_data', self::$dependency_api_data, 0 );
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-beta3-57735';
$wp_version = '6.5-beta3-57736';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.