Make WordPress Core

Ticket #46038: 46038.diff

File 46038.diff, 3.6 KB (added by schlessera, 6 years ago)

(replaced with an updated version)

  • src/wp-includes/class-wp-shutdown-handler.php

    diff --git src/wp-includes/class-wp-shutdown-handler.php src/wp-includes/class-wp-shutdown-handler.php
    index c55901dd4a..77771fb4fd 100644
    class WP_Shutdown_Handler { 
    136136                        $php_error_pluggable = WP_CONTENT_DIR . '/php-error.php';
    137137                        if ( is_readable( $php_error_pluggable ) ) {
    138138                                require_once $php_error_pluggable;
    139                                 die();
     139                                $args = array(
     140                                        'response' => 500,
     141                                        'exit'     => false,
     142                                );
     143
     144                                wp_die( '', '', $args );
    140145                        }
    141146                }
    142147
    class WP_Shutdown_Handler { 
    166171
    167172                $message = __( 'The site is experiencing technical difficulties.' );
    168173
    169                 $args = array( 'response' => 500 );
     174                $args = array(
     175                        'response' => 500,
     176                        'exit'     => false,
     177                );
     178
    170179                if ( function_exists( 'admin_url' ) ) {
    171180                        $args['link_url']  = admin_url();
    172181                        $args['link_text'] = __( 'Log into the admin backend to fix this.' );
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index 9552455d05..d11f309f34 100644
    function wp_nonce_ays( $action ) { 
    29552955 *     @type string $text_direction The text direction. This is only useful internally, when WordPress
    29562956 *                                  is still loading and the site's locale is not set up yet. Accepts 'rtl'.
    29572957 *                                  Default is the value of is_rtl().
     2958 *     @type bool   $exit           Whether to exit the process after completion. Defaults to true.
    29582959 * }
    29592960 */
    29602961function wp_die( $message = '', $title = '', $args = array() ) {
    function wp_die( $message = '', $title = '', $args = array() ) { 
    30213022 * @param string|array    $args    Optional. Arguments to control behavior. Default empty array.
    30223023 */
    30233024function _default_wp_die_handler( $message, $title = '', $args = array() ) {
    3024         $defaults = array( 'response' => 500 );
     3025        $defaults = array( 'response' => 500, 'exit' => true );
    30253026        $r        = wp_parse_args( $args, $defaults );
    30263027
    30273028        $have_gettext = function_exists( '__' );
    function _default_wp_die_handler( $message, $title = '', $args = array() ) { 
    32183219<body id="error-page">
    32193220<?php endif; // ! did_action( 'admin_head' ) ?>
    32203221        <?php echo $message; ?>
    3221 </body>
    3222 </html>
     3222        <?php // Open a display: none div to catch any subsequent output and hide it by default. ?>
     3223        <div style="display: none;">
    32233224        <?php
    3224         die();
     3225
     3226        if ( true === $args['exit'] ) {
     3227                die();
     3228        }
    32253229}
    32263230
    32273231/**
    function _json_wp_die_handler( $message, $title = '', $args = array() ) { 
    32553259        }
    32563260
    32573261        echo wp_json_encode( $data );
    3258         die();
     3262
     3263        if ( true === $args['exit'] ) {
     3264                die();
     3265        }
    32593266}
    32603267
    32613268/**
    function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 
    32823289                $error = new IXR_Error( $r['response'], $message );
    32833290                $wp_xmlrpc_server->output( $error->getXml() );
    32843291        }
    3285         die();
     3292
     3293        if ( true === $args['exit'] ) {
     3294                die();
     3295        }
    32863296}
    32873297
    32883298/**
    function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { 
    33073317                status_header( $r['response'] );
    33083318        }
    33093319
    3310         if ( is_scalar( $message ) ) {
    3311                 die( (string) $message );
     3320        echo is_scalar( $message ) ? (string) $message : '0';
     3321
     3322        if ( true === $args['exit'] ) {
     3323                die();
    33123324        }
    3313         die( '0' );
    33143325}
    33153326
    33163327/**
    function _ajax_wp_die_handler( $message, $title = '', $args = array() ) { 
    33253336 */
    33263337function _scalar_wp_die_handler( $message = '' ) {
    33273338        if ( is_scalar( $message ) ) {
    3328                 die( (string) $message );
     3339                echo (string) $message;
     3340        }
     3341
     3342        if ( true === $args['exit'] ) {
     3343                die();
    33293344        }
    3330         die();
    33313345}
    33323346
    33333347/**