[wp-trac] [WordPress Trac] #58263: REQUEST_METHOD Warning with server cron

WordPress Trac noreply at wordpress.org
Sat May 6 03:09:45 UTC 2023


#58263: REQUEST_METHOD Warning with server cron
--------------------------+-------------------------------
 Reporter:  nendeb55      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.2
 Severity:  normal        |   Keywords:  changes-requested
  Focuses:                |
--------------------------+-------------------------------
 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)
 {{{#!php
 if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters(
 'exit_on_http_head', true ) ) {
  }}}
 To
 {{{#!php
 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

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58263>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list