Skip to content

Commit 868e43d

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@55296 602fd350-edb4-49c9-b593-d223f7449a82
1 parent fe11908 commit 868e43d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/wp-admin/includes/update-core.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1595,11 +1595,22 @@ function update_core( $from, $to ) {
15951595
*
15961596
* @global array $_old_requests_files Requests files to be preloaded.
15971597
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
1598+
* @global string $wp_version The WordPress version string.
15981599
*
15991600
* @param string $to Path to old WordPress installation.
16001601
*/
16011602
function _preload_old_requests_classes_and_interfaces( $to ) {
1602-
global $_old_requests_files, $wp_filesystem;
1603+
global $_old_requests_files, $wp_filesystem, $wp_version;
1604+
1605+
/*
1606+
* Requests was introduced in WordPress 4.6.
1607+
*
1608+
* Skip preloading if the website was previously using
1609+
* an earlier version of WordPress.
1610+
*/
1611+
if ( version_compare( $wp_version, '4.6', '<' ) ) {
1612+
return;
1613+
}
16031614

16041615
if ( ! defined( 'REQUESTS_SILENCE_PSR0_DEPRECATIONS' ) ) {
16051616
define( 'REQUESTS_SILENCE_PSR0_DEPRECATIONS', true );

0 commit comments

Comments
 (0)