Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#48283 closed defect (bug) (fixed)

Cron: 'Headers already sent' warning with `ALTERNATE_WP_CRON`

Reported by: dlh's profile dlh Owned by: jorbin's profile jorbin
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.3
Component: Cron API Keywords: has-patch
Focuses: Cc:

Description

After [45560], a "Headers already sent" warning is generated when ALTERNATE_WP_CRON is enabled. The cause seems to be that spawn_cron() adds headers via wp_redirect() and then sends headers before loading wp-cron.php.

The attached patch would add a headers_sent() check before the two caching headers.

Attachments (1)

48283.diff (648 bytes) - added by dlh 5 years ago.

Download all attachments as: .zip

Change History (3)

@dlh
5 years ago

#1 @jorbin
5 years ago

  • Milestone changed from Awaiting Review to 5.3

#2 @jorbin
5 years ago

  • Owner set to jorbin
  • Resolution set to fixed
  • Status changed from new to closed

In 46458:

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.

Note: See TracTickets for help on using tickets.