WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/21/2019 08:14:56 PM (2 years ago)
Author:
flixos90
Message:

Bootstrap/Load: Change shutdown handler naming to final fatal error handler and allow disabling the handler entirely via a constant.

The WP_Shutdown_Handler name plus related function names were premature when originally committed, as there can be multiple shutdown handlers in PHP, and WordPress makes use of that feature. This changeset modifies the name to a more appropriate WP_Fatal_Error_Handler, and related to that changes the following names:

  • The drop-in to override the handler is now called fatal-error-handler.php.
  • The internal function wp_register_premature_shutdown_handler is now called wp_register_fatal_error_handler().

In addition to these naming changes, a new constant WP_DISABLE_FATAL_ERROR_HANDLER is introduced that can be set in wp-config.php to entirely disable the fatal error handler. That constant's value is and should be accessed indirectly via a new wp_is_fatal_error_handler_enabled() function and is filterable via a new wp_fatal_error_handler_enabled hook. Note that disabling the fatal error handler will skip the new functionality entirely, including the potentially used fatal-error-handler.php drop-in.

The new set of constant, filter and function provide for an easier-to-use mechanism to disable the fatal error handler altogether, rather than requiring developers to implement a drop-in for purely that purpose.

Props afragen, flixos90, joyously, knutsp, markjaquith, ocean90, schlessera, spacedmonkey.
Fixes #46047. See #44458.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r44630 r44674  
    469469function _get_dropins() {
    470470    $dropins = array(
    471         'advanced-cache.php'   => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE
    472         'db.php'               => array( __( 'Custom database class.' ), true ), // auto on load
    473         'db-error.php'         => array( __( 'Custom database error message.' ), true ), // auto on error
    474         'install.php'          => array( __( 'Custom installation script.' ), true ), // auto on installation
    475         'maintenance.php'      => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance
    476         'object-cache.php'     => array( __( 'External object cache.' ), true ), // auto on load
    477         'php-error.php'        => array( __( 'Custom PHP error message.' ), true ), // auto on error
    478         'shutdown-handler.php' => array( __( 'Custom PHP shutdown handler.' ), true ), // auto on error
     471        'advanced-cache.php'      => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE
     472        'db.php'                  => array( __( 'Custom database class.' ), true ), // auto on load
     473        'db-error.php'            => array( __( 'Custom database error message.' ), true ), // auto on error
     474        'install.php'             => array( __( 'Custom installation script.' ), true ), // auto on installation
     475        'maintenance.php'         => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance
     476        'object-cache.php'        => array( __( 'External object cache.' ), true ), // auto on load
     477        'php-error.php'           => array( __( 'Custom PHP error message.' ), true ), // auto on error
     478        'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ), // auto on error
    479479    );
    480480
Note: See TracChangeset for help on using the changeset viewer.