Make WordPress Core

Ticket #46038: 46038.2.diff

File 46038.2.diff, 3.2 KB (added by flixos90, 6 years ago)
  • src/wp-includes/class-wp-shutdown-handler.php

     
    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                                return;
    140140                        }
    141141                }
    142142
     
    166166
    167167                $message = __( 'The site is experiencing technical difficulties.' );
    168168
    169                 $args = array( 'response' => 500 );
     169                $args = array(
     170                        'response' => 500,
     171                        'exit'     => false,
     172                );
    170173                if ( function_exists( 'admin_url' ) ) {
    171174                        $args['link_url']  = admin_url();
    172175                        $args['link_text'] = __( 'Log into the admin backend to fix this.' );
  • src/wp-includes/functions.php

     
    29572957 *                                  Default is the value of is_rtl().
    29582958 *     @type string $code           Error code to use. Default is 'wp_die', or the main error code if $message
    29592959 *                                  is a WP_Error.
     2960 *     @type bool   $exit           Whether to exit the process after completion. Default true.
    29602961 * }
    29612962 */
    29622963function wp_die( $message = '', $title = '', $args = array() ) {
     
    32013202</body>
    32023203</html>
    32033204        <?php
    3204         die();
     3205        if ( $r['exit'] ) {
     3206                die();
     3207        }
    32053208}
    32063209
    32073210/**
     
    32363239        }
    32373240
    32383241        echo wp_json_encode( $data );
    3239         die();
     3242        if ( $r['exit'] ) {
     3243                die();
     3244        }
    32403245}
    32413246
    32423247/**
     
    32623267                $error = new IXR_Error( $r['response'], $message );
    32633268                $wp_xmlrpc_server->output( $error->getXml() );
    32643269        }
    3265         die();
     3270        if ( $r['exit'] ) {
     3271                die();
     3272        }
    32663273}
    32673274
    32683275/**
     
    32913298        }
    32923299
    32933300        if ( is_scalar( $message ) ) {
    3294                 die( (string) $message );
     3301                $message = (string) $message;
     3302        } else {
     3303                $message = '0';
    32953304        }
    3296         die( '0' );
     3305
     3306        if ( $r['exit'] ) {
     3307                die( $message );
     3308        } else {
     3309                echo $message;
     3310        }
    32973311}
    32983312
    32993313/**
     
    33023316 * This is the handler for wp_die when processing APP requests.
    33033317 *
    33043318 * @since 3.4.0
     3319 * @since 5.1.0 Added the $title and $args parameters.
    33053320 * @access private
    33063321 *
    3307  * @param string $message Optional. Response to print. Default empty.
     3322 * @param string       $message Optional. Response to print. Default empty.
     3323 * @param string       $title   Optional. Error title (unused). Default empty.
     3324 * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
    33083325 */
    3309 function _scalar_wp_die_handler( $message = '' ) {
     3326function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) {
     3327        list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
     3328
     3329        if ( $r['exit'] ) {
     3330                if ( is_scalar( $message ) ) {
     3331                        die( (string) $message );
     3332                }
     3333                die();
     3334        }
     3335
    33103336        if ( is_scalar( $message ) ) {
    3311                 die( (string) $message );
     3337                echo (string) $message;
    33123338        }
    3313         die();
    33143339}
    33153340
    33163341/**
     
    33283353        $defaults = array(
    33293354                'response'          => 0,
    33303355                'code'              => '',
     3356                'exit'              => true,
    33313357                'back_link'         => false,
    33323358                'link_url'          => '',
    33333359                'link_text'         => '',