WordPress.org

Make WordPress Core

Changeset 38956


Ignore:
Timestamp:
10/26/2016 02:31:33 PM (3 years ago)
Author:
johnbillion
Message:

Formatting: Don't overwrite the status header for Ajax responses that use output buffering or otherwise set their headers early.

Fixes #35666

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r38929 r38956  
    28812881    $r = wp_parse_args( $args, $defaults );
    28822882
    2883     if ( ! headers_sent() ) {
     2883    if ( ! headers_sent() && null !== $r['response'] ) {
    28842884        status_header( $r['response'] );
    28852885    }
     2886
    28862887    if ( is_scalar( $message ) )
    28872888        die( (string) $message );
     
    31123113    }
    31133114    echo wp_json_encode( $response );
    3114     if ( wp_doing_ajax() )
    3115         wp_die();
    3116     else
     3115
     3116    if ( wp_doing_ajax() ) {
     3117        wp_die( '', '', array(
     3118            'response' => null,
     3119        ) );
     3120    } else {
    31173121        die;
     3122    }
    31183123}
    31193124
Note: See TracChangeset for help on using the changeset viewer.