+ /**
+ * Callback to use with PHP's set_exception_handler.
+ *
+ * @since 1.31
+ * @param Exception|Throwable $e
+ */
+ public static function handleUncaughtException( $e ) {
+ self::handleException( $e );
+
+ // Make sure we don't claim success on exit for CLI scripts (T177414)
+ if ( PHP_SAPI === 'cli' ) {
+ register_shutdown_function(
+ function () {
+ exit( 255 );
+ }
+ );
+ }
+ }
+