From 9150652fedf418b015bc980ebb14110c16fac7eb Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 21 Nov 2020 14:39:03 +0000 Subject: [PATCH] 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 --- wp-admin/includes/class-wp-debug-data.php | 14 ++++++++------ wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 1f3ebf8f0b..c52f0058b3 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -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 = ''; + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 5571682bc4..a52e210383 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.