Make WordPress Core

Changeset 46458


Ignore:
Timestamp:
10/10/2019 10:50:05 PM (5 years ago)
Author:
jorbin
Message:

Cron: Prevent sending headers when using ALTERNATE_WP_CRON

ALTERNATE_WP_CRON echos things which causes a "Headers already sent" warning. This adds a check to ensure headers haven't already been sent.

Previously: [45560]

See: #45560. Fixes #48283.
Props dlh.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-cron.php

    r46142 r46458  
    2121/* Don't make the request block till we finish, if possible. */
    2222if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
    23     header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
    24     header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
     23    if ( ! headers_sent() ) {
     24        header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
     25        header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
     26    }
     27
    2528    fastcgi_finish_request();
    2629}
Note: See TracChangeset for help on using the changeset viewer.