From 3557ce0af223b544b59467c74faa2264e4336279 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 17 Aug 2020 01:04:04 +0000 Subject: [PATCH] Site Health: Recognize `define( 'WP_AUTO_UPDATE_CORE', 'minor' )` as an acceptable value. Previously, it was only incidentally recognized as valid due to a loose comparison with `true`. With the strict comparison added to `WP_Site_Health_Auto_Updates::test_constants()`, this was no longer the case. Follow-up to [47841]. Props sterndata, mukesh27, avixansa, desrosj, SergeyBiryukov. Merges [48792] to the 5.5 branch. Fixes #50912. Built from https://develop.svn.wordpress.org/branches/5.5@48804 git-svn-id: http://core.svn.wordpress.org/branches/5.5@48566 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../includes/class-wp-site-health-auto-updates.php | 12 ++++++++---- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/class-wp-site-health-auto-updates.php b/wp-admin/includes/class-wp-site-health-auto-updates.php index a7ebf07d49..4e3383eb1a 100644 --- a/wp-admin/includes/class-wp-site-health-auto-updates.php +++ b/wp-admin/includes/class-wp-site-health-auto-updates.php @@ -27,7 +27,7 @@ class WP_Site_Health_Auto_Updates { */ public function run_tests() { $tests = array( - $this->test_constants( 'WP_AUTO_UPDATE_CORE', true ), + $this->test_constants( 'WP_AUTO_UPDATE_CORE', array( true, 'minor' ) ), $this->test_wp_version_check_attached(), $this->test_filters_automatic_updater_disabled(), $this->test_wp_automatic_updates_disabled(), @@ -60,13 +60,17 @@ class WP_Site_Health_Auto_Updates { * Test if auto-updates related constants are set correctly. * * @since 5.2.0 + * @since 5.5.1 The `$value` parameter can accept an array. * - * @param string $constant The name of the constant to check. - * @param bool $value The value that the constant should be, if set. + * @param string $constant The name of the constant to check. + * @param bool|string|array $value The value that the constant should be, if set, + * or an array of acceptable values. * @return array The test results. */ public function test_constants( $constant, $value ) { - if ( defined( $constant ) && constant( $constant ) !== $value ) { + $acceptable_values = (array) $value; + + if ( defined( $constant ) && ! in_array( constant( $constant ), $acceptable_values, true ) ) { return array( 'description' => sprintf( /* translators: %s: Name of the constant used. */ diff --git a/wp-includes/version.php b/wp-includes/version.php index 17a442a0fc..cae0163af6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5.1-alpha-48803'; +$wp_version = '5.5.1-alpha-48804'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.