diff --git a/wp-includes/class-wp-fatal-error-handler.php b/wp-includes/class-wp-fatal-error-handler.php
index f17011cc33..aba6207bae 100644
a
|
b
|
class WP_Fatal_Error_Handler { |
41 | 41 | load_default_textdomain(); |
42 | 42 | } |
43 | 43 | |
| 44 | $handled = false; |
| 45 | |
44 | 46 | if ( ! is_multisite() && wp_recovery_mode()->is_initialized() ) { |
45 | | wp_recovery_mode()->handle_error( $error ); |
| 47 | $handled = wp_recovery_mode()->handle_error( $error ); |
46 | 48 | } |
47 | 49 | |
48 | 50 | // Display the PHP error template if headers not sent. |
49 | 51 | if ( is_admin() || ! headers_sent() ) { |
50 | | $this->display_error_template( $error ); |
| 52 | $this->display_error_template( $error, $handled ); |
51 | 53 | } |
52 | 54 | } catch ( Exception $e ) { |
53 | 55 | // Catch exceptions and remain silent. |
… |
… |
class WP_Fatal_Error_Handler { |
125 | 127 | * If no such drop-in is available, this will call {@see WP_Fatal_Error_Handler::display_default_error_template()}. |
126 | 128 | * |
127 | 129 | * @since 5.2.0 |
| 130 | * @since 5.2.2 The `$handled` parameter was added. |
128 | 131 | * |
129 | | * @param array $error Error information retrieved from `error_get_last()`. |
| 132 | * @param array $error Error information retrieved from `error_get_last()`. |
| 133 | * @param bool|WP_Error $handled Whether Recovery Mode handled the fatal error. |
130 | 134 | */ |
131 | | protected function display_error_template( $error ) { |
| 135 | protected function display_error_template( $error, $handled ) { |
132 | 136 | if ( defined( 'WP_CONTENT_DIR' ) ) { |
133 | 137 | // Load custom PHP error template, if present. |
134 | 138 | $php_error_pluggable = WP_CONTENT_DIR . '/php-error.php'; |
… |
… |
class WP_Fatal_Error_Handler { |
140 | 144 | } |
141 | 145 | |
142 | 146 | // Otherwise, display the default error template. |
143 | | $this->display_default_error_template( $error ); |
| 147 | $this->display_default_error_template( $error, $handled ); |
144 | 148 | } |
145 | 149 | |
146 | 150 | /** |
… |
… |
class WP_Fatal_Error_Handler { |
153 | 157 | * be used to modify these parameters. |
154 | 158 | * |
155 | 159 | * @since 5.2.0 |
| 160 | * @since 5.2.2 The `$handled` parameter was added. |
156 | 161 | * |
157 | | * @param array $error Error information retrieved from `error_get_last()`. |
| 162 | * @param array $error Error information retrieved from `error_get_last()`. |
| 163 | * @param bool|WP_Error $handled Whether Recovery Mode handled the fatal error. |
158 | 164 | */ |
159 | | protected function display_default_error_template( $error ) { |
| 165 | protected function display_default_error_template( $error, $handled ) { |
160 | 166 | if ( ! function_exists( '__' ) ) { |
161 | 167 | wp_load_translations_early(); |
162 | 168 | } |
… |
… |
class WP_Fatal_Error_Handler { |
169 | 175 | require_once ABSPATH . WPINC . '/class-wp-error.php'; |
170 | 176 | } |
171 | 177 | |
172 | | if ( is_protected_endpoint() ) { |
| 178 | if ( true === $handled && wp_is_recovery_mode() ) { |
| 179 | $message = __( 'A fatal error was caught by recovery mode. Check the Plugins and/or Themes page for details.' ); |
| 180 | } elseif ( is_protected_endpoint() ) { |
173 | 181 | $message = __( 'The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.' ); |
174 | 182 | } else { |
175 | 183 | $message = __( 'The site is experiencing technical difficulties.' ); |