Support » Plugin: WP fail2ban » 4.0.1: PHP notice from cron

  • Resolved Danila Vershinin


    When real Linux cron is configured (e.g. * * * * * php /path/to/wp-cron.php), running cron produces a notice:

    PHP Notice: Undefined index: REQUEST_METHOD in /wp-content/plugins/wp-fail2ban/vendor/freemius/wordpress-sdk/config.php on line 166

    Naturally, … because REQUEST_METHOD is not available in CLI context.

    Many folks are relying on errors written to stdout / emailed by cron. The empty output when running wp-cron.php means a healthy cron run.

    Can you please fix the plugin so that it won’t emit any notices when running wp-cron.php directly?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author invisnet


    I can’t reproduce that here.

    However, I’ve had a quick look through the Freemius code, and in order to get that error you’d need to have $_SERVER['HTTP_HOST'] set, but $_SERVER['REQUEST_METHOD'] not set.

    I’ll report it as a bug to Freemius, but it looks like you’ve got something weird going on with your configuration. Could you add var_dump($_SERVER); somewhere around line 147 in that file and see what it looks like?

    Thread Starter Danila Vershinin


    You’re very right. I am passing $_SERVER['HTTP_HOST'] to deal with other plugin’s errors in CLI context 🙂

    Plugin Author invisnet


    OK, I’ve submitted a PR for the Freemius WordPress SDK – hopefully the fix will make it into the next release.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘4.0.1: PHP notice from cron’ is closed to new replies.