From ecb93250144642a3ef545d6ee489c765424f2c53 Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Wed, 8 Feb 2023 15:03:19 +0000 Subject: [PATCH] Upgrade/Install: Skip preloading Requests for WordPress versions before 4.6. Skip preloading Requests files in `_preload_old_requests_classes_and_interfaces()` when updating from a WordPress version older than 4.6. Why? Requests library was first introduced into WordPress 4.6 via #33055 / [37428]. If a user is upgrading from a version older than 4.6, this changeset prevents the Requests preloading to prevent a fatal error of attempting to load files that do not exist in their current WordPress version. Follow-up to [54997], [37428]. Props afragen, costdev, ironprogrammer, antonvlasenko. Fixes #57662. Built from https://develop.svn.wordpress.org/trunk@55296 git-svn-id: http://core.svn.wordpress.org/trunk@54829 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/update-core.php | 13 ++++++++++++- wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index ac305ada4a..170746370a 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -1595,11 +1595,22 @@ 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; + global $_old_requests_files, $wp_filesystem, $wp_version; + + /* + * Requests was introduced in WordPress 4.6. + * + * Skip preloading if the website was previously using + * an earlier version of WordPress. + */ + if ( version_compare( $wp_version, '4.6', '<' ) ) { + return; + } if ( ! defined( 'REQUESTS_SILENCE_PSR0_DEPRECATIONS' ) ) { define( 'REQUESTS_SILENCE_PSR0_DEPRECATIONS', true ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 8ca160a42f..de1280cb5d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-beta1-55295'; +$wp_version = '6.2-beta1-55296'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.