• Whenever the cron job runs (which is called via crontab using php8 command line and not wget or curl), the following error gets logged:

    Error (E_WARNING): “Undefined array key “REQUEST_METHOD““ at ./wp-content/plugins/wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php:130.

    Just to clarify this is the line in my crontab file:
    */5 * * * * /usr/bin/php8.0 /var/www/mysite.com/public/wp-cron.php >> /dev/null 2>&1

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @ajtatum,
    huh! that is wired. Looked at the code of wp-cloudflare-super-page-cache.php on line no 130. So, that error is coming because when you are running the cron job for some reason $_SERVER['REQUEST_METHOD'] does not exist. So, inside a if block we are checking if the request is GET request and to do that we are doing strcasecmp($_SERVER['REQUEST_METHOD'], 'GET') == 0.

    But when you are running the cron job, for some reason the $_SERVER array does not have request method in it. Can you look further into why it is happening? As I am also running PHP 8 along with this plugin on many sites and have not seen this issue.

    Thread Starter ajtatum

    (@ajtatum)

    Could it be because of how I’m calling wp-cron since it’s not via a request (wget or curl)?

    Plugin Contributor iSaumya

    (@isaumya)

    It maybe. Hav4e you tried setting up the corn via WP CLI?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Undefined array key “REQUEST_METHOD“’ is closed to new replies.