From 1ee362004fa0a2013164bdf6f19f4508be02c49d Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 1 Feb 2022 00:14:06 +0000 Subject: [PATCH] Upgrade: Prevent warnings upgrading cron array. An unvisited site may have an undefined cron array, resulting in `_get_cron_array()` returning the value `false`. Previously this would trigger warning in `upgrade_590()` as the function assumed `_get_cron_array()` would alway return an array. No database version change is required as the upgrade routine was successful on sites with a cron array during 5.9.0. On sites without a cron array, the error has already been thrown if they are running db version 51917. This fix is only required for new sites or those upgrading that have skipped 5.9.0. Follow up to [51917]. Props chrisvanpatten, kapilpaul, SergeyBiryukov. Fixes #54906. See #53940. Built from https://develop.svn.wordpress.org/trunk@52656 git-svn-id: http://core.svn.wordpress.org/trunk@52245 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/upgrade.php | 9 ++++++--- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 96997518a1..8c3fc97cf1 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -2273,9 +2273,12 @@ function upgrade_590() { if ( $wp_current_db_version < 51917 ) { $crons = _get_cron_array(); - // Remove errant `false` values, see #53950. - $crons = array_filter( $crons ); - _set_cron_array( $crons ); + + if ( $crons && is_array( $crons ) ) { + // Remove errant `false` values, see #53950. + $crons = array_filter( $crons ); + _set_cron_array( $crons ); + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index a9b3551496..0e5d4403a3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52655'; +$wp_version = '6.0-alpha-52656'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.