Bootstrap/Load: After [45016], make sure `wp_die()` does not cause `_doing_it_wrong()` notices if called before `$wp_query` global is set.

Props tmdesigned, TimothyBlynJacobs.
Fixes #46813.
Built from https://develop.svn.wordpress.org/trunk@45206


git-svn-id: http://core.svn.wordpress.org/trunk@45015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-04-15 23:49:53 +00:00
parent c75d21589d
commit 7af011a5f0
2 changed files with 8 additions and 4 deletions

View File

@ -2945,6 +2945,8 @@ function wp_nonce_ays( $action ) {
* an integer to be used as the response code. * an integer to be used as the response code.
* @since 5.1.0 The `$link_url`, `$link_text`, and `$exit` arguments were added. * @since 5.1.0 The `$link_url`, `$link_text`, and `$exit` arguments were added.
* *
* @global WP_Query $wp_query Global WP_Query instance.
*
* @param string|WP_Error $message Optional. Error message. If this is a WP_Error object, * @param string|WP_Error $message Optional. Error message. If this is a WP_Error object,
* and not an Ajax or XML-RPC request, the error's messages are used. * and not an Ajax or XML-RPC request, the error's messages are used.
* Default empty. * Default empty.
@ -2971,6 +2973,7 @@ function wp_nonce_ays( $action ) {
* } * }
*/ */
function wp_die( $message = '', $title = '', $args = array() ) { function wp_die( $message = '', $title = '', $args = array() ) {
global $wp_query;
if ( is_int( $args ) ) { if ( is_int( $args ) ) {
$args = array( 'response' => $args ); $args = array( 'response' => $args );
@ -3016,9 +3019,10 @@ function wp_die( $message = '', $title = '', $args = array() ) {
*/ */
$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' ); $function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
} elseif ( wp_is_xml_request() } elseif ( wp_is_xml_request()
|| function_exists( 'is_feed' ) && is_feed() || isset( $wp_query ) &&
|| function_exists( 'is_comment_feed' ) && is_comment_feed() ( function_exists( 'is_feed' ) && is_feed()
|| function_exists( 'is_trackback' ) && is_trackback() ) { || function_exists( 'is_comment_feed' ) && is_comment_feed()
|| function_exists( 'is_trackback' ) && is_trackback() ) ) {
/** /**
* Filters the callback for killing WordPress execution for XML requests. * Filters the callback for killing WordPress execution for XML requests.
* *

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.2-beta3-45205'; $wp_version = '5.2-beta3-45206';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.