Make WordPress Core

Ticket #58420: 58420-2.patch

File 58420-2.patch, 15.8 KB (added by nihar007, 2 years ago)

I replaced all the "die" with "wp_die()" function

  • src/wp-activate.php

    diff --git a/src/wp-activate.php b/src/wp-activate.php
    index 728edcf4e3..aac18c3793 100644
    a b require __DIR__ . '/wp-blog-header.php'; 
    1515
    1616if ( ! is_multisite() ) {
    1717        wp_redirect( wp_registration_url() );
    18         die();
     18        wp_die();
    1919}
    2020
    2121$valid_error_codes = array( 'already_active', 'blog_taken' );
  • src/wp-admin/comment.php

    diff --git a/src/wp-admin/comment.php b/src/wp-admin/comment.php
    index 17f85a093a..3c7301aaee 100644
    a b switch ( $action ) { 
    102102
    103103                if ( ! $comment ) {
    104104                        wp_redirect( admin_url( 'edit-comments.php?error=1' ) );
    105                         die();
     105                        wp_die();
    106106                }
    107107
    108108                if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
    109109                        wp_redirect( admin_url( 'edit-comments.php?error=2' ) );
    110                         die();
     110                        wp_die();
    111111                }
    112112
    113113                // No need to re-approve/re-trash/re-spam a comment.
    114114                if ( str_replace( '1', 'approve', $comment->comment_approved ) === $action ) {
    115115                        wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
    116                         die();
     116                        wp_die();
    117117                }
    118118
    119119                require_once ABSPATH . 'wp-admin/admin-header.php';
    switch ( $action ) { 
    338338                }
    339339
    340340                wp_redirect( $redir );
    341                 die;
     341                wp_die();
    342342
    343343        case 'editedcomment':
    344344                $comment_id      = absint( $_POST['comment_ID'] );
  • src/wp-admin/export.php

    diff --git a/src/wp-admin/export.php b/src/wp-admin/export.php
    index 7c59c9e6c0..d50d06cc7b 100644
    a b if ( isset( $_GET['download'] ) ) { 
    121121        $args = apply_filters( 'export_args', $args );
    122122
    123123        export_wp( $args );
    124         die();
     124        wp_die();
    125125}
    126126
    127127require_once ABSPATH . 'wp-admin/admin-header.php';
  • src/wp-admin/includes/class-wp-site-health.php

    diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php
    index 2a91be3f60..a2be390a06 100644
    a b class WP_Site_Health { 
    238238
    239239                echo ( has_filter( 'wp_version_check', 'wp_version_check' ) ? 'yes' : 'no' );
    240240
    241                 die();
     241                wp_die();
    242242        }
    243243
    244244        /**
  • src/wp-admin/includes/comment.php

    diff --git a/src/wp-admin/includes/comment.php b/src/wp-admin/includes/comment.php
    index ffec90c81e..84f9af0bec 100644
    a b function enqueue_comment_hotkeys_js() { 
    215215function comment_footer_die( $msg ) {
    216216        echo "<div class='wrap'><p>$msg</p></div>";
    217217        require_once ABSPATH . 'wp-admin/admin-footer.php';
    218         die;
     218        wp_die();
    219219}
  • src/wp-admin/includes/network.php

    diff --git a/src/wp-admin/includes/network.php b/src/wp-admin/includes/network.php
    index 027297d598..7a5d1af90c 100644
    a b function network_step1( $errors = false ) { 
    120120                ) . '</p></div>';
    121121                echo '</div>';
    122122                require_once ABSPATH . 'wp-admin/admin-footer.php';
    123                 die();
     123                wp_die();
    124124        }
    125125
    126126        $active_plugins = get_option( 'active_plugins' );
    function network_step1( $errors = false ) { 
    133133                echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
    134134                echo '</div>';
    135135                require_once ABSPATH . 'wp-admin/admin-footer.php';
    136                 die();
     136                wp_die();
    137137        }
    138138
    139139        $hostname  = get_clean_basedomain();
    function network_step1( $errors = false ) { 
    148148                echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
    149149                echo '</div>';
    150150                require_once ABSPATH . 'wp-admin/admin-footer.php';
    151                 die();
     151                wp_die();
    152152        }
    153153
    154154        echo '<form method="post">';
  • src/wp-admin/link-parse-opml.php

    diff --git a/src/wp-admin/link-parse-opml.php b/src/wp-admin/link-parse-opml.php
    index c573db6f60..a202a63669 100644
    a b  
    77 */
    88
    99if ( ! defined( 'ABSPATH' ) ) {
    10         die();
     10        wp_die();
    1111}
    1212
    1313/**
  • src/wp-admin/site-health-info.php

    diff --git a/src/wp-admin/site-health-info.php b/src/wp-admin/site-health-info.php
    index 7676a8dc90..546b2f2cfd 100644
    a b  
    77 */
    88
    99if ( ! defined( 'ABSPATH' ) ) {
    10         die();
     10        wp_die();
    1111}
    1212
    1313if ( ! class_exists( 'WP_Debug_Data' ) ) {
  • src/wp-admin/update.php

    diff --git a/src/wp-admin/update.php b/src/wp-admin/update.php
    index 29480c2840..f3953cc07b 100644
    a b if ( isset( $_GET['action'] ) ) { 
    8585                        wp_redirect( admin_url( 'update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce'] ) );
    8686                        activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
    8787                        wp_redirect( admin_url( 'update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce'] ) );
    88                         die();
     88                        wp_die();
    8989                }
    9090                iframe_header( __( 'Plugin Reactivation' ), true );
    9191                if ( isset( $_GET['success'] ) ) {
  • src/wp-admin/user-edit.php

    diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
    index 2f1c468b53..7d12e4db8c 100644
    a b if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) { 
    116116                wp_update_user( $user );
    117117                delete_user_meta( $current_user->ID, '_new_email' );
    118118                wp_redirect( add_query_arg( array( 'updated' => 'true' ), self_admin_url( 'profile.php' ) ) );
    119                 die();
     119                wp_die();
    120120        } else {
    121121                wp_redirect( add_query_arg( array( 'error' => 'new-email' ), self_admin_url( 'profile.php' ) ) );
    122122        }
    if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) { 
    124124        check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' );
    125125        delete_user_meta( $current_user->ID, '_new_email' );
    126126        wp_redirect( add_query_arg( array( 'updated' => 'true' ), self_admin_url( 'profile.php' ) ) );
    127         die();
     127        wp_die();
    128128}
    129129
    130130switch ( $action ) {
  • src/wp-admin/user-new.php

    diff --git a/src/wp-admin/user-new.php b/src/wp-admin/user-new.php
    index 1c62f18cb3..d5ce382e7d 100644
    a b if ( isset( $_REQUEST['action'] ) && 'adduser' === $_REQUEST['action'] ) { 
    4141                        $user_details = get_user_by( 'login', $user_email );
    4242                } else {
    4343                        wp_redirect( add_query_arg( array( 'update' => 'enter_email' ), 'user-new.php' ) );
    44                         die();
     44                        wp_die();
    4545                }
    4646        }
    4747
    4848        if ( ! $user_details ) {
    4949                wp_redirect( add_query_arg( array( 'update' => 'does_not_exist' ), 'user-new.php' ) );
    50                 die();
     50                wp_die();
    5151        }
    5252
    5353        if ( ! current_user_can( 'promote_user', $user_details->ID ) ) {
    Please click the following link to confirm the invite: 
    179179                }
    180180        }
    181181        wp_redirect( $redirect );
    182         die();
     182        wp_die();
    183183} elseif ( isset( $_REQUEST['action'] ) && 'createuser' === $_REQUEST['action'] ) {
    184184        check_admin_referer( 'create-user', '_wpnonce_create-user' );
    185185
    Please click the following link to confirm the invite: 
    203203                                $redirect = add_query_arg( 'update', 'add', 'user-new.php' );
    204204                        }
    205205                        wp_redirect( $redirect );
    206                         die();
     206                        wp_die();
    207207                }
    208208        } else {
    209209                // Adding a new user to this site.
    Please click the following link to confirm the invite: 
    246246                                $redirect = add_query_arg( array( 'update' => 'newuserconfirmation' ), 'user-new.php' );
    247247                        }
    248248                        wp_redirect( $redirect );
    249                         die();
     249                        wp_die();
    250250                }
    251251        }
    252252}
  • src/wp-cron.php

    diff --git a/src/wp-cron.php b/src/wp-cron.php
    index f4211d82cd..125724c2a6 100644
    a b if ( PHP_VERSION_ID >= 70016 && function_exists( 'fastcgi_finish_request' ) ) { 
    3131}
    3232
    3333if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
    34         die();
     34        wp_die();
    3535}
    3636
    3737/**
    function _get_cron_lock() { 
    8080
    8181$crons = wp_get_ready_cron_jobs();
    8282if ( empty( $crons ) ) {
    83         die();
     83        wp_die();
    8484}
    8585
    8686$gmt_time = microtime( true );
    if ( _get_cron_lock() === $doing_wp_cron ) { 
    199199        delete_transient( 'doing_cron' );
    200200}
    201201
    202 die();
     202wp_die();
  • src/wp-includes/canonical.php

    diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php
    index a02ab793ce..a2c17b72c5 100644
    a b function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    480480                                        $redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
    481481
    482482                                        wp_redirect( $redirect_url, 301 );
    483                                         die();
     483                                        wp_die();
    484484                                }
    485485                        }
    486486
    function redirect_canonical( $requested_url = null, $do_redirect = true ) { 
    539539                        }
    540540
    541541                        wp_redirect( $redirect_url, 301 );
    542                         die();
     542                        wp_die();
    543543                }
    544544        }
    545545
  • src/wp-includes/class-simplepie.php

    diff --git a/src/wp-includes/class-simplepie.php b/src/wp-includes/class-simplepie.php
    index 2bd27359e6..bea833dad4 100644
    a b class SimplePie 
    712712                if (version_compare(PHP_VERSION, '5.6', '<'))
    713713                {
    714714                        trigger_error('Please upgrade to PHP 5.6 or newer.');
    715                         die();
     715                        wp_die();
    716716                }
    717717
    718718                // Other objects, instances created here so we can set options on them
  • src/wp-includes/class-wp-ajax-response.php

    diff --git a/src/wp-includes/class-wp-ajax-response.php b/src/wp-includes/class-wp-ajax-response.php
    index fb90d2ddac..d3aaa2fe33 100644
    a b class WP_Ajax_Response { 
    159159                if ( wp_doing_ajax() ) {
    160160                        wp_die();
    161161                } else {
    162                         die();
     162                        wp_die();
    163163                }
    164164        }
    165165}
  • src/wp-includes/class-wp-recovery-mode-link-service.php

    diff --git a/src/wp-includes/class-wp-recovery-mode-link-service.php b/src/wp-includes/class-wp-recovery-mode-link-service.php
    index 4fb888c5d6..5cee3cda90 100644
    a b class WP_Recovery_Mode_Link_Service { 
    9393
    9494                $url = add_query_arg( 'action', self::LOGIN_ACTION_ENTERED, wp_login_url() );
    9595                wp_redirect( $url );
    96                 die;
     96                wp_die();
    9797        }
    9898
    9999        /**
  • src/wp-includes/class-wp-recovery-mode.php

    diff --git a/src/wp-includes/class-wp-recovery-mode.php b/src/wp-includes/class-wp-recovery-mode.php
    index bed00d4ef8..8bd1a3d717 100644
    a b class WP_Recovery_Mode { 
    232232
    233233                if ( ! $this->is_active() ) {
    234234                        wp_safe_redirect( $redirect_to );
    235                         die;
     235                        wp_die();
    236236                }
    237237
    238238                if ( ! isset( $_GET['action'] ) || self::EXIT_ACTION !== $_GET['action'] ) {
    class WP_Recovery_Mode { 
    248248                }
    249249
    250250                wp_safe_redirect( $redirect_to );
    251                 die;
     251                wp_die();
    252252        }
    253253
    254254        /**
  • src/wp-includes/class-wpdb.php

    diff --git a/src/wp-includes/class-wpdb.php b/src/wp-includes/class-wpdb.php
    index d5ed464e0b..7556e958e9 100644
    a b class wpdb { 
    20612061                        // Load custom DB error template, if present.
    20622062                        if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
    20632063                                require_once WP_CONTENT_DIR . '/db-error.php';
    2064                                 die();
     2064                                wp_die();
    20652065                        }
    20662066
    20672067                        $message = '<h1>' . __( 'Error establishing a database connection' ) . "</h1>\n";
  • src/wp-includes/functions.php

    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index d7ad450680..d11faec532 100644
    a b function _default_wp_die_handler( $message, $title = '', $args = array() ) { 
    39303930</html>
    39313931        <?php
    39323932        if ( $parsed_args['exit'] ) {
    3933                 die();
     3933                wp_die();
    39343934        }
    39353935}
    39363936
    function _json_wp_die_handler( $message, $title = '', $args = array() ) { 
    40104010
    40114011        echo wp_json_encode( $data );
    40124012        if ( $parsed_args['exit'] ) {
    4013                 die();
     4013                wp_die();
    40144014        }
    40154015}
    40164016
    function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) { 
    40524052        $jsonp_callback = $_GET['_jsonp'];
    40534053        echo '/**/' . $jsonp_callback . '(' . $result . ')';
    40544054        if ( $parsed_args['exit'] ) {
    4055                 die();
     4055                wp_die();
    40564056        }
    40574057}
    40584058
    function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) { 
    40844084                $wp_xmlrpc_server->output( $error->getXml() );
    40854085        }
    40864086        if ( $parsed_args['exit'] ) {
    4087                 die();
     4087                wp_die();
    40884088        }
    40894089}
    40904090
    EOD; 
    41284128
    41294129        echo $xml;
    41304130        if ( $parsed_args['exit'] ) {
    4131                 die();
     4131                wp_die();
    41324132        }
    41334133}
    41344134
    function _scalar_wp_die_handler( $message = '', $title = '', $args = array() ) { 
    41524152                if ( is_scalar( $message ) ) {
    41534153                        die( (string) $message );
    41544154                }
    4155                 die();
     4155                wp_die();
    41564156        }
    41574157
    41584158        if ( is_scalar( $message ) ) {
    function wp_send_json( $response, $status_code = null, $options = 0 ) { 
    44364436                        )
    44374437                );
    44384438        } else {
    4439                 die;
     4439                wp_die();
    44404440        }
    44414441}
    44424442
    function dead_db() { 
    53665366        // Load custom DB error template, if present.
    53675367        if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
    53685368                require_once WP_CONTENT_DIR . '/db-error.php';
    5369                 die();
     5369                wp_die();
    53705370        }
    53715371
    53725372        // If installing or in the admin, provide the verbose message.
  • src/wp-includes/load.php

    diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
    index 02bf0299bf..7b7a00b8c5 100644
    a b function wp_maintenance() { 
    295295
    296296        if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
    297297                require_once WP_CONTENT_DIR . '/maintenance.php';
    298                 die();
     298                wp_die();
    299299        }
    300300
    301301        require_once ABSPATH . WPINC . '/functions.php';
    function wp_not_installed() { 
    811811        $link = wp_guess_url() . '/wp-admin/install.php';
    812812
    813813        wp_redirect( $link );
    814         die();
     814        wp_die();
    815815}
    816816
    817817/**
    function wp_start_scraping_edited_file_errors() { 
    16761676                        )
    16771677                );
    16781678                echo "###### wp_scraping_result_end:$key ######";
    1679                 die();
     1679                wp_die();
    16801680        }
    16811681        if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
    16821682                define( 'WP_SANDBOX_SCRAPING', true );
  • src/wp-includes/pluggable.php

    diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
    index 9a811edc3a..5425e25fc5 100644
    a b if ( ! function_exists( 'check_admin_referer' ) ) : 
    12831283
    12841284                if ( ! $result && ! ( -1 === $action && str_starts_with( $referer, $adminurl ) ) ) {
    12851285                        wp_nonce_ays( $action );
    1286                         die();
     1286                        wp_die();
    12871287                }
    12881288
    12891289                return $result;
  • src/wp-includes/rest-api.php

    diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
    index d9dd834c90..fe0ed92608 100644
    a b function rest_api_loaded() { 
    410410        $server->serve_request( $route );
    411411
    412412        // We're done.
    413         die();
     413        wp_die();
    414414}
    415415
    416416/**
  • src/wp-settings.php

    diff --git a/src/wp-settings.php b/src/wp-settings.php
    index 6a7e809872..8f5a05a690 100644
    a b if ( is_multisite() ) { 
    626626        $file = ms_site_check();
    627627        if ( true !== $file ) {
    628628                require $file;
    629                 die();
     629                wp_die();
    630630        }
    631631        unset( $file );
    632632}
  • src/wp-signup.php

    diff --git a/src/wp-signup.php b/src/wp-signup.php
    index 9782dad499..44a14b3366 100644
    a b nocache_headers(); 
    1111
    1212if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ), true ) ) {
    1313        wp_redirect( network_home_url() );
    14         die();
     14        wp_wp_die();
    1515}
    1616
    1717/**
    add_action( 'wp_head', 'do_signup_header' ); 
    3131
    3232if ( ! is_multisite() ) {
    3333        wp_redirect( wp_registration_url() );
    34         die();
     34        wp_die();
    3535}
    3636
    3737if ( ! is_main_site() ) {
    3838        wp_redirect( network_site_url( 'wp-signup.php' ) );
    39         die();
     39        wp_die();
    4040}
    4141
    4242// Fix for page title.
    function validate_another_blog_signup() { 
    432432        global $blogname, $blog_title, $errors, $domain, $path;
    433433        $current_user = wp_get_current_user();
    434434        if ( ! is_user_logged_in() ) {
    435                 die();
     435                wp_die();
    436436        }
    437437
    438438        $result = validate_blog_form();
  • src/wp-trackback.php

    diff --git a/src/wp-trackback.php b/src/wp-trackback.php
    index 7512e33fb4..e937ac95ca 100644
    a b function trackback_response( $error = 0, $error_message = '' ) { 
    3636                echo "<error>1</error>\n";
    3737                echo "<message>$error_message</message>\n";
    3838                echo '</response>';
    39                 die();
     39                wp_die();
    4040        } else {
    4141                echo '<?xml version="1.0" encoding="utf-8"?' . ">\n";
    4242                echo "<response>\n";
    if ( $charset ) { 
    6666
    6767// No valid uses for UTF-7.
    6868if ( false !== strpos( $charset, 'UTF-7' ) ) {
    69         die;
     69        wp_die();
    7070}
    7171
    7272// For international trackbacks.