From 08844a2c429299250c5f0e2ecc3ac95f3fefa0db Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 15 May 2019 19:54:53 +0000 Subject: [PATCH] Bootstrap/Load: Prevent PHP errors when a drop-in triggers fatal error 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. Built from https://develop.svn.wordpress.org/branches/5.2@45315 git-svn-id: http://core.svn.wordpress.org/branches/5.2@45126 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-fatal-error-handler.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-fatal-error-handler.php b/wp-includes/class-wp-fatal-error-handler.php index 96958d10de..f17011cc33 100644 --- a/wp-includes/class-wp-fatal-error-handler.php +++ b/wp-includes/class-wp-fatal-error-handler.php @@ -37,7 +37,7 @@ class WP_Fatal_Error_Handler { return; } - if ( ! isset( $GLOBALS['wp_locale'] ) ) { + if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) { load_default_textdomain(); } @@ -165,6 +165,10 @@ class WP_Fatal_Error_Handler { 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 { diff --git a/wp-includes/version.php b/wp-includes/version.php index b9b2bcdf98..4896d626a0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.2.1-alpha-45314'; +$wp_version = '5.2.1-alpha-45315'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.