From 466937669a23364593f5ab8fcea46ad147c2ab55 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Thu, 10 Oct 2019 22:50:05 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@46458 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-cron.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wp-cron.php b/src/wp-cron.php index 1a944c216e..d3ab354eda 100644 --- a/src/wp-cron.php +++ b/src/wp-cron.php @@ -20,8 +20,11 @@ ignore_user_abort( true ); /* Don't make the request block till we finish, if possible. */ if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) { - header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); - header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); + if ( ! headers_sent() ) { + header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' ); + header( 'Cache-Control: no-cache, must-revalidate, max-age=0' ); + } + fastcgi_finish_request(); }