From 847bac4a166b96c25cc07d73e3d4bd655a76ec1c Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 5 Oct 2024 22:51:16 +0000 Subject: [PATCH] General: Do not use the new `wp_get_wp_version()` in `update-core.php` and `class-core-upgrader.php`. All functions that are used there must be present in both the previous version being upgraded from, and the later version that's being installed (e.g. when rolling back Core) as these files are used in both. Props djennez, SergeyBiryukov, jorbin, peterwilsoncc, azaozz. Fixes #62165. See 61627. Built from https://develop.svn.wordpress.org/trunk@59180 git-svn-id: http://core.svn.wordpress.org/trunk@58575 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-core-upgrader.php | 9 +++++++-- wp-admin/includes/update-core.php | 15 ++++++++++----- wp-includes/version.php | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/wp-admin/includes/class-core-upgrader.php b/wp-admin/includes/class-core-upgrader.php index 0629e0b8e1..7c1d5e9c10 100644 --- a/wp-admin/includes/class-core-upgrader.php +++ b/wp-admin/includes/class-core-upgrader.php @@ -13,6 +13,11 @@ * It allows for WordPress to upgrade itself in combination with * the wp-admin/includes/update-core.php file. * + * Note: newly introduced functions and methods cannot be used here. + * All functions must be present in both the previous version being upgraded from, + * and the later version that's being installed (e.g. when rolling back Core) + * as this file is used in both. + * * @since 2.8.0 * @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php. * @@ -391,13 +396,13 @@ class Core_Upgrader extends WP_Upgrader { * * @since 3.7.0 * + * @global string $wp_version The WordPress version string. * @global string $wp_local_package Locale code of the package. * * @return bool True if the checksums match, otherwise false. */ public function check_files() { - global $wp_local_package; - $wp_version = wp_get_wp_version(); + global $wp_version, $wp_local_package; $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 639faba224..1a814aa5f8 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -2,6 +2,11 @@ /** * WordPress core upgrade functionality. * + * Note: newly introduced functions and methods cannot be used here. + * All functions must be present in both the previous version being upgraded from, + * and the later version that's being installed (e.g. when rolling back Core) + * as this file is used in both. + * * @package WordPress * @subpackage Administration * @since 2.7.0 @@ -1539,12 +1544,12 @@ function update_core( $from, $to ) { * * @global array $_old_requests_files Requests files to be preloaded. * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + * @global string $wp_version The WordPress version string. * * @param string $to Path to old WordPress installation. */ function _preload_old_requests_classes_and_interfaces( $to ) { - global $_old_requests_files, $wp_filesystem; - $wp_version = wp_get_wp_version(); + global $_old_requests_files, $wp_filesystem, $wp_version; /* * Requests was introduced in WordPress 4.6. @@ -1587,14 +1592,14 @@ function _preload_old_requests_classes_and_interfaces( $to ) { * * @since 3.3.0 * - * @global string $pagenow The filename of the current screen. + * @global string $wp_version The WordPress version string. + * @global string $pagenow The filename of the current screen. * @global string $action * * @param string $new_version */ function _redirect_to_about_wordpress( $new_version ) { - global $pagenow, $action; - $wp_version = wp_get_wp_version(); + global $wp_version, $pagenow, $action; if ( version_compare( $wp_version, '3.4-RC1', '>=' ) ) { return; diff --git a/wp-includes/version.php b/wp-includes/version.php index 7eb4c0009b..8b00edb316 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-beta1-59179'; +$wp_version = '6.7-beta1-59180'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.