From 10ae39872708eef26edb4817c11268b5609e1727 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 13 Jan 2020 17:27:06 +0000 Subject: [PATCH] Site Health: Avoid "Undefined property" PHP notices in `wp_dashboard_site_health()` when the status result transient does not exist yet. Props dlh for initial patch. See #47606. Built from https://develop.svn.wordpress.org/trunk@47069 git-svn-id: http://core.svn.wordpress.org/trunk@46869 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 12 ++++++------ wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 5a917f6b11..9533c24dec 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -1772,21 +1772,21 @@ function dashboard_php_nag_class( $classes ) { function wp_dashboard_site_health() { $get_issues = get_transient( 'health-check-site-status-result' ); - $issue_counts = new stdClass(); + $issue_counts = array(); if ( false !== $get_issues ) { - $issue_counts = json_decode( $get_issues ); + $issue_counts = json_decode( $get_issues, true ); } - if ( ! is_object( $issue_counts ) || empty( $issue_counts ) ) { - $issue_counts = (object) array( + if ( ! is_array( $issue_counts ) || ! $issue_counts ) { + $issue_counts = array( 'good' => 0, 'recommended' => 0, 'critical' => 0, ); } - $issues_total = $issue_counts->recommended + $issue_counts->critical; + $issues_total = $issue_counts['recommended'] + $issue_counts['critical']; ?>
@@ -1821,7 +1821,7 @@ function wp_dashboard_site_health() {

- critical > 0 ) : ?> + 0 ) : ?> diff --git a/wp-includes/version.php b/wp-includes/version.php index 4be0ff40ef..4f11beae11 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-47068'; +$wp_version = '5.4-alpha-47069'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.