Site Health: Check if $core_updates is an array before iterating on it.

This avoids a PHP warning if `get_core_updates()` returns `false`.

Props paulschreiber.
Fixes #51818.
Built from https://develop.svn.wordpress.org/trunk@49676


git-svn-id: http://core.svn.wordpress.org/trunk@49399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-11-21 14:39:03 +00:00
parent 5ab5b3e73b
commit 9150652fed
2 changed files with 9 additions and 7 deletions

View File

@ -48,12 +48,14 @@ class WP_Debug_Data {
$core_updates = get_core_updates();
$core_update_needed = '';
foreach ( $core_updates as $core => $update ) {
if ( 'upgrade' === $update->response ) {
/* translators: %s: Latest WordPress version number. */
$core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version );
} else {
$core_update_needed = '';
if ( is_array( $core_updates ) ) {
foreach ( $core_updates as $core => $update ) {
if ( 'upgrade' === $update->response ) {
/* translators: %s: Latest WordPress version number. */
$core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version );
} else {
$core_update_needed = '';
}
}
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.7-alpha-49675';
$wp_version = '5.7-alpha-49676';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.