From 73ef224e64a872f48d896ea4d21cdbd26a19dcb0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 15 Mar 2020 19:45:07 +0000 Subject: [PATCH] Administration: When editing a plugin or theme file, close any active PHP session. This prevents HTTP requests from timing out when attempting to connect back to the site. Props bruandet, vjik, donmhico, SergeyBiryukov. Fixes #43358. Built from https://develop.svn.wordpress.org/trunk@47457 git-svn-id: http://core.svn.wordpress.org/trunk@47244 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index edfdef5756..5b11a07f6d 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -550,6 +550,13 @@ function wp_edit_theme_plugin_file( $args ) { } else { $url = admin_url(); } + + if ( PHP_SESSION_ACTIVE === session_status() ) { + // Close any active session to prevent HTTP requests from timing out + // when attempting to connect back to the site. + session_write_close(); + } + $url = add_query_arg( $scrape_params, $url ); $r = wp_remote_get( $url, compact( 'cookies', 'headers', 'timeout', 'sslverify' ) ); $body = wp_remote_retrieve_body( $r ); diff --git a/wp-includes/version.php b/wp-includes/version.php index ca4c706779..5a483bbcbe 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47456'; +$wp_version = '5.5-alpha-47457'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.