Formatting: Don't overwrite the status header for Ajax responses that use output buffering or otherwise set their headers early.
Fixes #35666 Built from https://develop.svn.wordpress.org/trunk@38956 git-svn-id: http://core.svn.wordpress.org/trunk@38899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
49c5fb895d
commit
6161ad9020
|
@ -2880,9 +2880,10 @@ function _ajax_wp_die_handler( $message, $title = '', $args = array() ) {
|
|||
);
|
||||
$r = wp_parse_args( $args, $defaults );
|
||||
|
||||
if ( ! headers_sent() ) {
|
||||
if ( ! headers_sent() && null !== $r['response'] ) {
|
||||
status_header( $r['response'] );
|
||||
}
|
||||
|
||||
if ( is_scalar( $message ) )
|
||||
die( (string) $message );
|
||||
die( '0' );
|
||||
|
@ -3111,11 +3112,15 @@ function wp_send_json( $response, $status_code = null ) {
|
|||
status_header( $status_code );
|
||||
}
|
||||
echo wp_json_encode( $response );
|
||||
if ( wp_doing_ajax() )
|
||||
wp_die();
|
||||
else
|
||||
|
||||
if ( wp_doing_ajax() ) {
|
||||
wp_die( '', '', array(
|
||||
'response' => null,
|
||||
) );
|
||||
} else {
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a JSON response back to an Ajax request, indicating success.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-alpha-38955';
|
||||
$wp_version = '4.7-alpha-38956';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue