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:
parent
ec05cd3168
commit
6d58109b09
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue