WordPress.org

Make WordPress Core

Changeset 45315


Ignore:
Timestamp:
05/15/2019 07:53:42 PM (6 months ago)
Author:
desrosj
Message:

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.

Location:
branches/5.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

  • branches/5.2/src/wp-includes/class-wp-fatal-error-handler.php

    r45277 r45315  
    3838            }
    3939
    40             if ( ! isset( $GLOBALS['wp_locale'] ) ) {
     40            if ( ! isset( $GLOBALS['wp_locale'] ) && function_exists( 'load_default_textdomain' ) ) {
    4141                load_default_textdomain();
    4242            }
     
    166166        }
    167167
     168        if ( ! class_exists( 'WP_Error' ) ) {
     169            require_once ABSPATH . WPINC . '/class-wp-error.php';
     170        }
     171
    168172        if ( is_protected_endpoint() ) {
    169173            $message = __( 'The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.' );
Note: See TracChangeset for help on using the changeset viewer.