Make WordPress Core

Ticket #46620: 46620.diff

File 46620.diff, 2.8 KB (added by johnbillion, 6 years ago)
  • src/wp-includes/class-wp-fatal-error-handler.php

    diff --git a/src/wp-includes/class-wp-fatal-error-handler.php b/src/wp-includes/class-wp-fatal-error-handler.php
    index e44dfed598..5e99a8433d 100644
    a b class WP_Fatal_Error_Handler { 
    4343                        }
    4444
    4545                        // Display the PHP error template.
    46                         $this->display_error_template();
     46                        $this->display_error_template( $error );
    4747                } catch ( Exception $e ) {
    4848                        // Catch exceptions and remain silent.
    4949                }
    class WP_Fatal_Error_Handler { 
    120120         * If no such drop-in is available, this will call {@see WP_Fatal_Error_Handler::display_default_error_template()}.
    121121         *
    122122         * @since 5.2.0
     123         *
     124         * @param array $error Error information retrieved from `error_get_last()`.
    123125         */
    124         protected function display_error_template() {
     126        protected function display_error_template( $error ) {
    125127                if ( defined( 'WP_CONTENT_DIR' ) ) {
    126128                        // Load custom PHP error template, if present.
    127129                        $php_error_pluggable = WP_CONTENT_DIR . '/php-error.php';
    class WP_Fatal_Error_Handler { 
    133135                }
    134136
    135137                // Otherwise, display the default error template.
    136                 $this->display_default_error_template();
     138                $this->display_default_error_template( $error );
    137139        }
    138140
    139141        /**
    class WP_Fatal_Error_Handler { 
    146148         * be used to modify these parameters.
    147149         *
    148150         * @since 5.2.0
     151         *
     152         * @param array $error Error information retrieved from `error_get_last()`.
    149153         */
    150         protected function display_default_error_template() {
     154        protected function display_default_error_template( $error ) {
    151155                if ( ! function_exists( '__' ) ) {
    152156                        wp_load_translations_early();
    153157                }
    class WP_Fatal_Error_Handler { 
    169173                 * @since 5.2.0
    170174                 *
    171175                 * @param string $message HTML error message to display.
     176                 * @param array  $error   Error information retrieved from `error_get_last()`.
    172177                 */
    173                 $message = apply_filters( 'wp_php_error_message', $message );
     178                $message = apply_filters( 'wp_php_error_message', $message, $error );
    174179
    175180                /**
    176181                 * Filters the arguments passed to {@see wp_die()} for the default PHP error template.
    class WP_Fatal_Error_Handler { 
    179184                 *
    180185                 * @param array $args Associative array of arguments passed to `wp_die()`. By default these contain a
    181186                 *                    'response' key, and optionally 'link_url' and 'link_text' keys.
     187                 * @param array $error Error information retrieved from `error_get_last()`.
    182188                 */
    183                 $args = apply_filters( 'wp_php_error_args', $args );
     189                $args = apply_filters( 'wp_php_error_args', $args, $error );
    184190
    185                 $error = new WP_Error( 'internal_server_error', $message );
     191                $wp_error = new WP_Error( 'internal_server_error', $message, array(
     192                        'error' => $error,
     193                ) );
    186194
    187                 wp_die( $error, '', $args );
     195                wp_die( $wp_error, '', $args );
    188196        }
    189197}