Skip to content

Conversation

@pierlon
Copy link

@pierlon pierlon commented Aug 11, 2021

Calling themes_api( 'query_themes' ) may not result in a successful API response and so a WP_Error is intended to be returned, but right before it is there is this block of code:

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;
}
}

This block of code should not be executed if $res is a WP_Error, which this PR fixes.

Trac ticket: https://core.trac.wordpress.org/ticket/53913


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@SergeyBiryukov
Copy link
Member

Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/51601.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants