Bootstrap/Load: Add `nocache_headers()` to all `wp_die()` handlers.

Props spacedmonkey.
Fixes #46054.
Built from https://develop.svn.wordpress.org/trunk@44828


git-svn-id: http://core.svn.wordpress.org/trunk@44660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-03-11 11:47:50 +00:00
parent 69939e4929
commit 51c0543bf2
2 changed files with 13 additions and 5 deletions

View File

@ -3058,9 +3058,9 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
if ( ! did_action( 'admin_head' ) ) :
if ( ! headers_sent() ) {
header( 'Content-Type: text/html; charset=utf-8' );
status_header( $r['response'] );
nocache_headers();
header( 'Content-Type: text/html; charset=utf-8' );
}
$text_direction = $r['text_direction'];
@ -3238,6 +3238,7 @@ function _json_wp_die_handler( $message, $title = '', $args = array() ) {
if ( null !== $r['response'] ) {
status_header( $r['response'] );
}
nocache_headers();
}
echo wp_json_encode( $data );
@ -3265,6 +3266,10 @@ function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
if ( ! headers_sent() ) {
nocache_headers();
}
if ( $wp_xmlrpc_server ) {
$error = new IXR_Error( $r['response'], $message );
$wp_xmlrpc_server->output( $error->getXml() );
@ -3295,9 +3300,12 @@ function _ajax_wp_die_handler( $message, $title = '', $args = array() ) {
list( $message, $title, $r ) = _wp_die_process_input( $message, $title, $args );
// This is intentional. For backward-compatibility, support passing null here.
if ( ! headers_sent() && null !== $args['response'] ) {
status_header( $r['response'] );
if ( ! headers_sent() ) {
// This is intentional. For backward-compatibility, support passing null here.
if ( null !== $args['response'] ) {
status_header( $r['response'] );
}
nocache_headers();
}
if ( is_scalar( $message ) ) {

View File

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