Bootstrap/Load: Ensure WP_Fatal_Error_Handler does not conflict with existing mechanisms treating fatal errors.
Prior to this change, resuming or activating a plugin or theme that is still broken would result in a redirect loop if in recovery mode. If outside recovery mode, it would cause the error template to be displayed. Furthermore this applies to breaking a plugin or theme when editing from the backend. Props aandrewdixon, azaozz, dhanukanuwan, henrywright, ocean90, ohiosierra, PandelisZ, xkon. Fixes #46045, #46751. Built from https://develop.svn.wordpress.org/trunk@45114 git-svn-id: http://core.svn.wordpress.org/trunk@44923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user