Skip to content
Permalink
Browse files

Bootstrap/Load: Prevent PHP errors when a drop-in triggers fatal erro…

…r protection.

When a drop-in (such as `advanced-cache.php`) contains a PHP error, additional PHP errors are caused when displaying the error protection screen because `load_default_textdomain()` and `WP_Error` are not yet available.

Though recovery mode is not supported for `mu-plugins` and drop-ins, fatal error protection is. This change ensures the error screen is displayed when a fatal error is encountered within a drop-in and not a white screen.

Merges [45311] to the 5.2 branch.

Props TimothyBlynJacobs, spacedmonkey, daxelrod.
Fixes #47265.

git-svn-id: https://develop.svn.wordpress.org/branches/5.2@45315 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
desrosj committed May 15, 2019
1 parent 271d57e commit bf36def844dd3f9877e5823fc892201434246b0b
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/wp-includes/class-wp-fatal-error-handler.php
@@ -37,7 +37,7 @@ public function handle() {
return;
}
if ( ! isset( $GLOBALS['wp_locale'] ) ) {
if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) {
load_default_textdomain();
}
@@ -165,6 +165,10 @@ protected function display_default_error_template( $error ) {
require_once ABSPATH . WPINC . '/functions.php';
}
if ( ! class_exists( 'WP_Error' ) ) {
require_once ABSPATH . WPINC . '/class-wp-error.php';
}
if ( is_protected_endpoint() ) {
$message = __( 'The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.' );
} else {

0 comments on commit bf36def

Please sign in to comment.
You can’t perform that action at this time.