WordPress.org

Make WordPress Core

Ticket #46045: 46045.2.diff

File 46045.2.diff, 2.5 KB (added by flixos90, 14 months ago)
  • src/wp-admin/includes/plugin.php

    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 
    631631                if ( ! empty( $redirect ) ) {
    632632                        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
    633633                }
     634
    634635                ob_start();
    635636                wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
    636637                $_wp_plugin_file = $plugin;
     638                define( 'WP_SANDBOX_SCRAPING', true );
    637639                include_once( WP_PLUGIN_DIR . '/' . $plugin );
    638640                $plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin.
    639641
    function wp_clean_plugins_cache( $clear_update_cache = true ) { 
    21252127 * @param string $plugin Path to the plugin file relative to the plugins directory.
    21262128 */
    21272129function plugin_sandbox_scrape( $plugin ) {
     2130        define( 'WP_SANDBOX_SCRAPING', true );
    21282131        wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
    21292132        include( WP_PLUGIN_DIR . '/' . $plugin );
    21302133}
  • src/wp-admin/includes/theme.php

    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 = '' ) { 
    859859
    860860                        // Load the theme's functions.php to test whether it throws a fatal error.
    861861                        ob_start();
     862                        define( 'WP_SANDBOX_SCRAPING', true );
    862863                        include $functions_path;
    863864                        ob_clean();
    864865                }
  • src/wp-includes/class-wp-fatal-error-handler.php

    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 { 
    2626         * @since 5.2.0
    2727         */
    2828        public function handle() {
     29                if ( defined( 'WP_SANDBOX_SCRAPING' ) && WP_SANDBOX_SCRAPING ) {
     30                        return;
     31                }
     32
    2933                try {
    3034                        // Bail if no error found.
    3135                        $error = $this->detect_error();
  • src/wp-includes/load.php

    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() { 
    14441444                echo "###### wp_scraping_result_end:$key ######";
    14451445                die();
    14461446        }
     1447        define( 'WP_SANDBOX_SCRAPING', true );
    14471448        register_shutdown_function( 'wp_finalize_scraping_edited_file_errors', $key );
    14481449}
    14491450