• Hi,

    I’ve come across what appears to be a CLI compatibility issue with WPS Hide Login.

    When running WordPress cron directly via PHP CLI, the following warning is generated:

    PHP Warning: Undefined array key “REQUEST_METHOD” in /wp-content/plugins/wps-hide-login/vendor/composer/autoload_real.php on line 59

    My environment:

    • WordPress: Latest
    • WPS Hide Login: Latest
    • PHP-FPM: 8.2
    • PHP CLI: 8.2.32
    • Ubuntu 22.04 LTS

    To reproduce: /usr/bin/php8.2 /var/www/example.com/wp-cron.php

    The cron completes, but this warning is displayed:

    PHP Warning: Undefined array key "REQUEST_METHOD"

    This appears to happen because $_SERVER['REQUEST_METHOD'] is not defined when WordPress is executed via the PHP CLI, whereas it is always available during normal web requests.

    Running WP-Cron via HTTP (e.g. curl https://example.com/wp-cron.php?doing_wp_cron) works without any warnings.

    Would it be possible to guard against the absence of $_SERVER['REQUEST_METHOD'] when running under the CLI, for example by checking PHP_SAPI === 'cli' or using isset($_SERVER['REQUEST_METHOD']) before accessing it?

    This would improve compatibility for sites that execute WP-Cron directly via PHP CLI.

    Thank you!

You must be logged in to reply to this topic.