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

Props spacedmonkey.
Fixes #46054.

git-svn-id: https://develop.svn.wordpress.org/trunk@44828 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-03-11 11:46:41 +00:00
parent cba9eda1f4
commit ae5940dd25
1 changed files with 12 additions and 4 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 ) ) {