Index: src/wp-includes/class-wp-shutdown-handler.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/class-wp-shutdown-handler.php	(revision 44628)
+++ src/wp-includes/class-wp-shutdown-handler.php	(date 1548097526000)
@@ -26,7 +26,7 @@
 	 */
 	public function handle() {
 		// Bail if WordPress executed successfully.
-		if ( defined( 'WP_EXECUTION_SUCCEEDED' ) && WP_EXECUTION_SUCCEEDED ) {
+		if ( $this->execution_succeeded() ) {
 			return;
 		}
 
@@ -50,6 +50,29 @@
 		}
 	}
 
+	/**
+	 * Check if execution has succeeded.
+	 *
+	 * @since 5.1.0
+	 *
+	 * @return bool $execution_succeeded If execution has succeeded
+	 */
+	function execution_succeeded() {
+		$execution_succeeded = ( defined( 'WP_EXECUTION_SUCCEEDED' ) && WP_EXECUTION_SUCCEEDED );
+		if ( function_exists( 'apply_filters' ) ) {
+			/**
+			 * Filters the value of WP_EXECUTION_SUCCEEDED constant.
+			 *
+			 * @since 5.1.0
+			 *
+			 * @param bool $execution_succeeded Default value of WP_EXECUTION_SUCCEEDED.
+			 */
+			$execution_succeeded = apply_filters( 'wp_execution_succeeded', $execution_succeeded );
+		}
+
+		return $execution_succeeded;
+	}
+
 	/**
 	 * Detects the error causing the crash if it should be handled.
 	 *
Index: src/wp-includes/rest-api.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/rest-api.php	(revision 44628)
+++ src/wp-includes/rest-api.php	(date 1548097526000)
@@ -289,7 +289,7 @@
 	 * @var bool
 	 */
 	define( 'REST_REQUEST', true );
-
+	add_filter( 'wp_execution_succeeded', '__return_false' );
 	// Initialize the server.
 	$server = rest_get_server();
 
@@ -299,7 +299,7 @@
 		$route = '/';
 	}
 	$server->serve_request( $route );
-
+	remove_filter( 'wp_execution_succeeded', '__return_false' );
 	// We're done.
 	die();
 }
