diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php
index 54c6db27ac..2716bd4fef 100644
|
a
|
b
|
function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silen |
| 631 | 631 | if ( ! empty( $redirect ) ) { |
| 632 | 632 | 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 |
| 633 | 633 | } |
| | 634 | |
| 634 | 635 | ob_start(); |
| 635 | 636 | wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); |
| 636 | 637 | $_wp_plugin_file = $plugin; |
| | 638 | define( 'WP_SANDBOX_SCRAPING', true ); |
| 637 | 639 | include_once( WP_PLUGIN_DIR . '/' . $plugin ); |
| 638 | 640 | $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin. |
| 639 | 641 | |
| … |
… |
function wp_clean_plugins_cache( $clear_update_cache = true ) { |
| 2125 | 2127 | * @param string $plugin Path to the plugin file relative to the plugins directory. |
| 2126 | 2128 | */ |
| 2127 | 2129 | function plugin_sandbox_scrape( $plugin ) { |
| | 2130 | define( 'WP_SANDBOX_SCRAPING', true ); |
| 2128 | 2131 | wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); |
| 2129 | 2132 | include( WP_PLUGIN_DIR . '/' . $plugin ); |
| 2130 | 2133 | } |
diff --git a/src/wp-admin/includes/theme.php b/src/wp-admin/includes/theme.php
index 1ab7959e5f..98391123aa 100644
|
a
|
b
|
function resume_theme( $theme, $redirect = '' ) { |
| 859 | 859 | |
| 860 | 860 | // Load the theme's functions.php to test whether it throws a fatal error. |
| 861 | 861 | ob_start(); |
| | 862 | define( 'WP_SANDBOX_SCRAPING', true ); |
| 862 | 863 | include $functions_path; |
| 863 | 864 | ob_clean(); |
| 864 | 865 | } |
diff --git a/src/wp-includes/class-wp-fatal-error-handler.php b/src/wp-includes/class-wp-fatal-error-handler.php
index 8ec87c9e24..270bb9e444 100644
|
a
|
b
|
class WP_Fatal_Error_Handler { |
| 26 | 26 | * @since 5.2.0 |
| 27 | 27 | */ |
| 28 | 28 | public function handle() { |
| | 29 | if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) { |
| | 30 | return; |
| | 31 | } |
| | 32 | |
| 29 | 33 | try { |
| 30 | 34 | // Bail if no error found. |
| 31 | 35 | $error = $this->detect_error(); |
diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
index f2c9318da6..1915fbde17 100644
|
a
|
b
|
function wp_start_scraping_edited_file_errors() { |
| 1444 | 1444 | echo "###### wp_scraping_result_end:$key ######"; |
| 1445 | 1445 | die(); |
| 1446 | 1446 | } |
| | 1447 | define( 'WP_SANDBOX_SCRAPING', true ); |
| 1447 | 1448 | register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key ); |
| 1448 | 1449 | } |
| 1449 | 1450 | |