diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 54c6db27ac..2716bd4fef 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -631,9 +631,11 @@ function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen if ( ! empty( $redirect ) ) { wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) ); // we'll override this later if the plugin can be included without fatal error } + ob_start(); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); $_wp_plugin_file = $plugin; + define( 'WP_SANDBOX_SCRAPING', true ); include_once( WP_PLUGIN_DIR . '/' . $plugin ); $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin. @@ -2125,6 +2127,7 @@ function wp_clean_plugins_cache( $clear_update_cache = true ) { * @param string $plugin Path to the plugin file relative to the plugins directory. */ function plugin_sandbox_scrape( $plugin ) { + define( 'WP_SANDBOX_SCRAPING', true ); wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); include( WP_PLUGIN_DIR . '/' . $plugin ); } diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 1ab7959e5f..98391123aa 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -859,6 +859,7 @@ function resume_theme( $theme, $redirect = '' ) { // Load the theme's functions.php to test whether it throws a fatal error. ob_start(); + define( 'WP_SANDBOX_SCRAPING', true ); include $functions_path; ob_clean(); } diff --git a/wp-includes/class-wp-fatal-error-handler.php b/wp-includes/class-wp-fatal-error-handler.php index 8ec87c9e24..270bb9e444 100644 --- a/wp-includes/class-wp-fatal-error-handler.php +++ b/wp-includes/class-wp-fatal-error-handler.php @@ -26,6 +26,10 @@ class WP_Fatal_Error_Handler { * @since 5.2.0 */ public function handle() { + if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) { + return; + } + try { // Bail if no error found. $error = $this->detect_error(); diff --git a/wp-includes/load.php b/wp-includes/load.php index f2c9318da6..1915fbde17 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -1444,6 +1444,7 @@ function wp_start_scraping_edited_file_errors() { echo "###### wp_scraping_result_end:$key ######"; die(); } + define( 'WP_SANDBOX_SCRAPING', true ); register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 95e6b9fba4..306d56ff32 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.2-beta1-45113'; +$wp_version = '5.2-beta1-45114'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.