Make WordPress Core

Opened 15 months ago

#58263 new defect (bug)

REQUEST_METHOD Warning with server cron

Reported by: nendeb55's profile nendeb55 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.2
Component: General Keywords: changes-requested
Focuses: Cc:

Description

I am trying server cron without WP-cron.
When I run server cron, I get the following warning.

PHP Warning: Undefined array key "REQUEST_METHOD" in /home/PARH/TO/public_html/wp-includes/template-loader.php on line 26
This is because REQUEST_METHOD is not available in server cron.

So we can use (template-loader.php on line 26)

if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) ) {

To

if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) ) {

Can this be changed to

TESTING
XSERVER
PHP7.4/8.0
WordPress6.2.0

Change History (0)

Note: See TracTickets for help on using tickets.