mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Themes: Make sure the theme API response is not an error before operating on it in themes_api()
.
This fixes a potential bug and avoids PHP warnings when `themes_api( 'query_themes' )` is called and a successful API response is not received. Follow-up to [42632]. Props pierlo. Fixes #53913. Built from https://develop.svn.wordpress.org/trunk@51601 git-svn-id: http://core.svn.wordpress.org/trunk@51212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bf20ded7d6
commit
e2a64f0cd2
@ -602,15 +602,18 @@ function themes_api( $action, $args = array() ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Back-compat for info/1.2 API, upgrade the theme objects in query_themes to objects.
|
||||
if ( 'query_themes' === $action ) {
|
||||
foreach ( $res->themes as $i => $theme ) {
|
||||
$res->themes[ $i ] = (object) $theme;
|
||||
if ( ! is_wp_error( $res ) ) {
|
||||
// Back-compat for info/1.2 API, upgrade the theme objects in query_themes to objects.
|
||||
if ( 'query_themes' === $action ) {
|
||||
foreach ( $res->themes as $i => $theme ) {
|
||||
$res->themes[ $i ] = (object) $theme;
|
||||
}
|
||||
}
|
||||
|
||||
// Back-compat for info/1.2 API, downgrade the feature_list result back to an array.
|
||||
if ( 'feature_list' === $action ) {
|
||||
$res = (array) $res;
|
||||
}
|
||||
}
|
||||
// Back-compat for info/1.2 API, downgrade the feature_list result back to an array.
|
||||
if ( 'feature_list' === $action ) {
|
||||
$res = (array) $res;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.9-alpha-51600';
|
||||
$wp_version = '5.9-alpha-51601';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
x
Reference in New Issue
Block a user