Index: src/wp-admin/includes/plugin.php
===================================================================
--- src/wp-admin/includes/plugin.php	(revision 44671)
+++ src/wp-admin/includes/plugin.php	(working copy)
@@ -468,14 +468,14 @@
  */
 function _get_dropins() {
 	$dropins = array(
-		'advanced-cache.php'   => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE
-		'db.php'               => array( __( 'Custom database class.' ), true ), // auto on load
-		'db-error.php'         => array( __( 'Custom database error message.' ), true ), // auto on error
-		'install.php'          => array( __( 'Custom installation script.' ), true ), // auto on installation
-		'maintenance.php'      => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance
-		'object-cache.php'     => array( __( 'External object cache.' ), true ), // auto on load
-		'php-error.php'        => array( __( 'Custom PHP error message.' ), true ), // auto on error
-		'shutdown-handler.php' => array( __( 'Custom PHP shutdown handler.' ), true ), // auto on error
+		'advanced-cache.php'      => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE
+		'db.php'                  => array( __( 'Custom database class.' ), true ), // auto on load
+		'db-error.php'            => array( __( 'Custom database error message.' ), true ), // auto on error
+		'install.php'             => array( __( 'Custom installation script.' ), true ), // auto on installation
+		'maintenance.php'         => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance
+		'object-cache.php'        => array( __( 'External object cache.' ), true ), // auto on load
+		'php-error.php'           => array( __( 'Custom PHP error message.' ), true ), // auto on error
+		'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ), // auto on error
 	);
 
 	if ( is_multisite() ) {
Index: src/wp-includes/class-wp-fatal-error-handler.php
===================================================================
--- src/wp-includes/class-wp-fatal-error-handler.php	(revision 44671)
+++ src/wp-includes/class-wp-fatal-error-handler.php	(working copy)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Error Protection API: WP_Shutdown_Handler class
+ * Error Protection API: WP_Fatal_Error_Handler class
  *
  * @package WordPress
  * @since 5.1.0
@@ -7,15 +7,16 @@
  */
 
 /**
- * Core class used as the default shutdown handler.
+ * Core class used as the default shutdown handler for fatal errors.
  *
- * A drop-in 'shutdown-handler.php' can be used to override the instance of this class and use a custom implementation
- * for the shutdown handler that WordPress registers. The custom class should extend this class and can override its
- * methods individually as necessary. The file must return the instance of the class that should be registered.
+ * A drop-in 'fatal-error-handler.php' can be used to override the instance of this class and use a custom
+ * implementation for the fatal error handler that WordPress registers. The custom class should extend this class and
+ * can override its methods individually as necessary. The file must return the instance of the class that should be
+ * registered.
  *
  * @since 5.1.0
  */
-class WP_Shutdown_Handler {
+class WP_Fatal_Error_Handler {
 
 	/**
 	 * Runs the shutdown handler.
@@ -126,7 +127,7 @@
 	 * very early in the WordPress bootstrap process, so any core functions used that are not part of
 	 * `wp-includes/load.php` should be checked for before being called.
 	 *
-	 * If no such drop-in is available, this will call {@see WP_Shutdown_Handler::display_default_error_template()}.
+	 * If no such drop-in is available, this will call {@see WP_Fatal_Error_Handler::display_default_error_template()}.
 	 *
 	 * @since 5.1.0
 	 */
Index: src/wp-includes/class-wp-shutdown-handler.php
===================================================================
--- src/wp-includes/class-wp-shutdown-handler.php	(revision 44671)
+++ src/wp-includes/class-wp-shutdown-handler.php	(nonexistent)
@@ -1,199 +0,0 @@
-<?php
-/**
- * Error Protection API: WP_Shutdown_Handler class
- *
- * @package WordPress
- * @since 5.1.0
- */
-
-/**
- * Core class used as the default shutdown handler.
- *
- * A drop-in 'shutdown-handler.php' can be used to override the instance of this class and use a custom implementation
- * for the shutdown handler that WordPress registers. The custom class should extend this class and can override its
- * methods individually as necessary. The file must return the instance of the class that should be registered.
- *
- * @since 5.1.0
- */
-class WP_Shutdown_Handler {
-
-	/**
-	 * Runs the shutdown handler.
-	 *
-	 * This method is registered via `register_shutdown_function()`.
-	 *
-	 * @since 5.1.0
-	 */
-	public function handle() {
-		// Bail if WordPress executed successfully.
-		if ( defined( 'WP_EXECUTION_SUCCEEDED' ) && WP_EXECUTION_SUCCEEDED ) {
-			return;
-		}
-
-		try {
-			// Bail if no error found.
-			$error = $this->detect_error();
-			if ( ! $error ) {
-				return;
-			}
-
-			// If the error was stored and thus the extension paused,
-			// redirect the request to catch multiple errors in one go.
-			if ( $this->store_error( $error ) ) {
-				$this->redirect_protected();
-			}
-
-			// Display the PHP error template.
-			$this->display_error_template();
-		} catch ( Exception $e ) {
-			// Catch exceptions and remain silent.
-		}
-	}
-
-	/**
-	 * Detects the error causing the crash if it should be handled.
-	 *
-	 * @since 5.1.0
-	 *
-	 * @return array|null Error that was triggered, or null if no error received or if the error should not be handled.
-	 */
-	protected function detect_error() {
-		$error = error_get_last();
-
-		// No error, just skip the error handling code.
-		if ( null === $error ) {
-			return null;
-		}
-
-		// Bail if this error should not be handled.
-		if ( ! wp_should_handle_error( $error ) ) {
-			return null;
-		}
-
-		return $error;
-	}
-
-	/**
-	 * Stores the given error so that the extension causing it is paused.
-	 *
-	 * @since 5.1.0
-	 *
-	 * @param array $error Error that was triggered.
-	 * @return bool True if the error was stored successfully, false otherwise.
-	 */
-	protected function store_error( $error ) {
-		// Do not pause extensions if they only crash on a non-protected endpoint.
-		if ( ! is_protected_endpoint() ) {
-			return false;
-		}
-
-		return wp_record_extension_error( $error );
-	}
-
-	/**
-	 * Redirects the current request to allow recovering multiple errors in one go.
-	 *
-	 * The redirection will only happen when on a protected endpoint.
-	 *
-	 * It must be ensured that this method is only called when an error actually occurred and will not occur on the
-	 * next request again. Otherwise it will create a redirect loop.
-	 *
-	 * @since 5.1.0
-	 */
-	protected function redirect_protected() {
-		// Do not redirect requests on non-protected endpoints.
-		if ( ! is_protected_endpoint() ) {
-			return;
-		}
-
-		// Pluggable is usually loaded after plugins, so we manually include it here for redirection functionality.
-		if ( ! function_exists( 'wp_redirect' ) ) {
-			include ABSPATH . WPINC . '/pluggable.php';
-		}
-
-		$scheme = is_ssl() ? 'https://' : 'http://';
-
-		$url = "{$scheme}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
-		wp_redirect( $url );
-		exit;
-	}
-
-	/**
-	 * Displays the PHP error template and sends the HTTP status code, typically 500.
-	 *
-	 * A drop-in 'php-error.php' can be used as a custom template. This drop-in should control the HTTP status code and
-	 * print the HTML markup indicating that a PHP error occurred. Note that this drop-in may potentially be executed
-	 * very early in the WordPress bootstrap process, so any core functions used that are not part of
-	 * `wp-includes/load.php` should be checked for before being called.
-	 *
-	 * If no such drop-in is available, this will call {@see WP_Shutdown_Handler::display_default_error_template()}.
-	 *
-	 * @since 5.1.0
-	 */
-	protected function display_error_template() {
-		if ( defined( 'WP_CONTENT_DIR' ) ) {
-			// Load custom PHP error template, if present.
-			$php_error_pluggable = WP_CONTENT_DIR . '/php-error.php';
-			if ( is_readable( $php_error_pluggable ) ) {
-				require_once $php_error_pluggable;
-				return;
-			}
-		}
-
-		// Otherwise, display the default error template.
-		$this->display_default_error_template();
-	}
-
-	/**
-	 * Displays the default PHP error template.
-	 *
-	 * This method is called conditionally if no 'php-error.php' drop-in is available.
-	 *
-	 * It calls {@see wp_die()} with a message indicating that the site is experiencing technical difficulties and a
-	 * login link to the admin backend. The {@see 'wp_php_error_message'} and {@see 'wp_php_error_args'} filters can
-	 * be used to modify these parameters.
-	 *
-	 * @since 5.1.0
-	 */
-	protected function display_default_error_template() {
-		if ( ! function_exists( '__' ) ) {
-			wp_load_translations_early();
-		}
-
-		if ( ! function_exists( 'wp_die' ) ) {
-			require_once ABSPATH . WPINC . '/functions.php';
-		}
-
-		$message = __( 'The site is experiencing technical difficulties.' );
-
-		$args = array(
-			'response' => 500,
-			'exit'     => false,
-		);
-		if ( function_exists( 'admin_url' ) ) {
-			$args['link_url']  = admin_url();
-			$args['link_text'] = __( 'Log into the admin backend to fix this.' );
-		}
-
-		/**
-		 * Filters the message that the default PHP error template displays.
-		 *
-		 * @since 5.1.0
-		 *
-		 * @param string $message HTML error message to display.
-		 */
-		$message = apply_filters( 'wp_php_error_message', $message );
-
-		/**
-		 * Filters the arguments passed to {@see wp_die()} for the default PHP error template.
-		 *
-		 * @since 5.1.0
-		 *
-		 * @param array $args Associative array of arguments passed to `wp_die()`. By default these contain a
-		 *                    'response' key, and optionally 'link_url' and 'link_text' keys.
-		 */
-		$args = apply_filters( 'wp_php_error_args', $args );
-
-		wp_die( $message, '', $args );
-	}
-}
Index: src/wp-includes/error-protection.php
===================================================================
--- src/wp-includes/error-protection.php	(revision 44671)
+++ src/wp-includes/error-protection.php	(working copy)
@@ -148,19 +148,48 @@
 }
 
 /**
- * Registers the WordPress premature shutdown handler.
+ * Registers the shutdown handler for fatal errors.
  *
+ * The handler will only be registered if {@see wp_is_fatal_error_handler_enabled()} returns true.
+ *
  * @since 5.1.0
  */
-function wp_register_premature_shutdown_handler() {
+function wp_register_fatal_error_handler() {
+	if ( ! wp_is_fatal_error_handler_enabled() ) {
+		return;
+	}
+
 	$handler = null;
-	if ( defined( 'WP_CONTENT_DIR' ) && is_readable( WP_CONTENT_DIR . '/shutdown-handler.php' ) ) {
-		$handler = include WP_CONTENT_DIR . '/shutdown-handler.php';
+	if ( defined( 'WP_CONTENT_DIR' ) && is_readable( WP_CONTENT_DIR . '/fatal-error-handler.php' ) ) {
+		$handler = include WP_CONTENT_DIR . '/fatal-error-handler.php';
 	}
 
 	if ( ! is_object( $handler ) || ! is_callable( array( $handler, 'handle' ) ) ) {
-		$handler = new WP_Shutdown_Handler();
+		$handler = new WP_Fatal_Error_Handler();
 	}
 
 	register_shutdown_function( array( $handler, 'handle' ) );
 }
+
+/**
+ * Checks whether the fatal error handler is enabled.
+ *
+ * A constant `WP_DISABLE_FATAL_ERROR_HANDLER` can be set in `wp-config.php` to disable it, or alternatively the
+ * {@see 'wp_fatal_error_handler_enabled'} filter can be used to modify the return value.
+ *
+ * @since 5.1.0
+ *
+ * @return bool True if the fatal error handler is enabled, false otherwise.
+ */
+function wp_is_fatal_error_handler_enabled() {
+	$enabled = ! defined( 'WP_DISABLE_FATAL_ERROR_HANDLER' ) || ! WP_DISABLE_FATAL_ERROR_HANDLER;
+
+	/**
+	 * Filters whether the fatal error handler is enabled.
+	 *
+	 * @since 5.1.0
+	 *
+	 * @param bool $enabled True if the fatal error handler is enabled, false otherwise.
+	 */
+	return apply_filters( 'wp_fatal_error_handler_enabled', $enabled );
+}
Index: src/wp-settings.php
===================================================================
--- src/wp-settings.php	(revision 44671)
+++ src/wp-settings.php	(working copy)
@@ -18,13 +18,13 @@
 // Include files required for initialization.
 require( ABSPATH . WPINC . '/load.php' );
 require( ABSPATH . WPINC . '/class-wp-paused-extensions-storage.php' );
-require( ABSPATH . WPINC . '/class-wp-shutdown-handler.php' );
+require( ABSPATH . WPINC . '/class-wp-fatal-error-handler.php' );
 require( ABSPATH . WPINC . '/error-protection.php' );
 require( ABSPATH . WPINC . '/default-constants.php' );
 require_once( ABSPATH . WPINC . '/plugin.php' );
 
-// Make sure we register the premature shutdown handler as soon as possible.
-wp_register_premature_shutdown_handler();
+// Make sure we register the shutdown handler for fatal errors as soon as possible.
+wp_register_fatal_error_handler();
 
 /*
  * These can't be directly globalized in version.php. When updating,
