From e46d1cfc84d3b4cd715ef07d3c3670cb4744048a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 27 Apr 2020 21:59:10 +0000 Subject: [PATCH] Site Health: Avoid a PHP notice in `WP_Site_Health::wp_cron_scheduled_check()` if async test response does not contain the expected result. Additionally, avoid a PHP notice in `::get_test_php_version()` if the minimum recommended version of PHP could not be determined. Props schlessera, oakesjosh. Fixes #49943. git-svn-id: https://develop.svn.wordpress.org/trunk@47628 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-site-health.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index f031e0a0f7..41aecf1a24 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/wp-admin/includes/class-wp-site-health.php @@ -719,7 +719,7 @@ class WP_Site_Health { sprintf( /* translators: %s: The minimum recommended PHP version. */ __( 'PHP is the programming language used to build and maintain WordPress. Newer versions of PHP are faster and more secure, so staying up to date will help your site’s overall performance and security. The minimum recommended version of PHP is %s.' ), - $response['recommended_version'] + $response ? $response['recommended_version'] : '' ) ), 'actions' => sprintf( @@ -2334,7 +2334,13 @@ class WP_Site_Health { } if ( ! is_wp_error( $result_fetch ) ) { - $results[] = json_decode( wp_remote_retrieve_body( $result_fetch ) ); + $result = json_decode( wp_remote_retrieve_body( $result_fetch ), true ); + } else { + $result = false; + } + + if ( is_array( $result ) ) { + $results[] = $result; } else { $results[] = array( 'status' => 'recommended',