Ticket #47321: 47321.4.diff
File 47321.4.diff, 3.0 KB (added by , 6 years ago) |
---|
-
src/wp-includes/class-wp-fatal-error-handler.php
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. … … 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'; … … 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 /** … … 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 } … … 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 = __( 'There has been a critical error on your website, putting it in recovery mode. Please check the Themes and Plugins pages for more details. If you just now installed a new Theme or Plugin, check the relevant page for that first.' ); 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.' );