diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index 605f194ca3..62f089b941 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -1015,6 +1015,46 @@ class WP_Site_Health { return $result; } + /** + * Test if the PHP default timezone is set to UTC. + * + * @since 5.3.1 + * + * @return array The test results. + */ + public function get_test_php_default_timezone() { + $result = array( + 'label' => __( 'PHP default timezone is valid' ), + 'status' => 'good', + 'badge' => array( + 'label' => __( 'Performance' ), + 'color' => 'blue', + ), + 'description' => sprintf( + '

%s

', + __( 'PHP default timezone was configured by WordPress on loading. This is necessary for correct calculations of dates and times.' ) + ), + 'test' => 'php_default_timezone', + ); + + if ( 'UTC' !== date_default_timezone_get() ) { + $result['status'] = 'critical'; + + $result['label'] = __( 'PHP default timezone is invalid' ); + + $result['description'] = sprintf( + '

%s

', + sprintf( + /* translators: %s: date_default_timezone_set() */ + __( 'PHP default timezone was changed after WordPress loading by a %s function call. This interferes with correct calculations of dates and times.' ), + 'date_default_timezone_set()' + ) + ); + } + + return $result; + } + /** * Test if the SQL server is up to date. * @@ -1842,51 +1882,55 @@ class WP_Site_Health { public static function get_tests() { $tests = array( 'direct' => array( - 'wordpress_version' => array( + 'wordpress_version' => array( 'label' => __( 'WordPress Version' ), 'test' => 'wordpress_version', ), - 'plugin_version' => array( + 'plugin_version' => array( 'label' => __( 'Plugin Versions' ), 'test' => 'plugin_version', ), - 'theme_version' => array( + 'theme_version' => array( 'label' => __( 'Theme Versions' ), 'test' => 'theme_version', ), - 'php_version' => array( + 'php_version' => array( 'label' => __( 'PHP Version' ), 'test' => 'php_version', ), - 'sql_server' => array( - 'label' => __( 'Database Server version' ), - 'test' => 'sql_server', - ), - 'php_extensions' => array( + 'php_extensions' => array( 'label' => __( 'PHP Extensions' ), 'test' => 'php_extensions', ), - 'utf8mb4_support' => array( + 'php_default_timezone' => array( + 'label' => __( 'PHP Default Timezone' ), + 'test' => 'php_default_timezone', + ), + 'sql_server' => array( + 'label' => __( 'Database Server version' ), + 'test' => 'sql_server', + ), + 'utf8mb4_support' => array( 'label' => __( 'MySQL utf8mb4 support' ), 'test' => 'utf8mb4_support', ), - 'https_status' => array( + 'https_status' => array( 'label' => __( 'HTTPS status' ), 'test' => 'https_status', ), - 'ssl_support' => array( + 'ssl_support' => array( 'label' => __( 'Secure communication' ), 'test' => 'ssl_support', ), - 'scheduled_events' => array( + 'scheduled_events' => array( 'label' => __( 'Scheduled events' ), 'test' => 'scheduled_events', ), - 'http_requests' => array( + 'http_requests' => array( 'label' => __( 'HTTP Requests' ), 'test' => 'http_requests', ), - 'debug_enabled' => array( + 'debug_enabled' => array( 'label' => __( 'Debugging enabled' ), 'test' => 'is_in_debug_mode', ), diff --git a/wp-includes/version.php b/wp-includes/version.php index 000aab4006..92633cc89a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46795'; +$wp_version = '5.4-alpha-46797'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.