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
This commit is contained in:
Sergey Biryukov 2020-03-15 19:45:07 +00:00
parent cf75b95197
commit 73ef224e64
2 changed files with 8 additions and 1 deletions

View File

@ -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 );

View File

@ -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.