Undefined index: SERVER_PORT when using wpcli
-
When the plugin is activated and you try to use wpcli to issue commands, it throws exceptions of Undefined index: SERVER_PORT/SERVER_NAME in /classes/wp-security-utility.php:32
This happens because the $_SERVER[] environment variables are not available via cli. An additional check needs to be implemented like:
if ( 'cli' === php_sapi_name() || defined('STDIN') ) { // This section of the code runs when WordPress is being runned from the terminal ... } else { // This section of the code run when WordPress is being run from the browser ... }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Undefined index: SERVER_PORT when using wpcli’ is closed to new replies.