Errors when used with WP-CLI
-
Hey. There’s a small error in this plugin which triggers when using WP-CLI.
PHP Warning: Undefined array key "HTTP_HOST" in /var/www/vhosts/example.com/htdocs/wp-content/plugins/related-posts-for-wp/classes/class-playground.php on line 9 Warning: Undefined array key "HTTP_HOST" in /var/www/vhosts/example.com/htdocs/wp-content/plugins/related-posts-for-wp/classes/class-playground.php on line 9
The error appears to be harmless, but it emits the error twice for every execution of WP-CLI, which is polluting the logs of our automated processes. On one website with Related Posts for WP installed that error message appears in the logs over 50 times every day when a number of automated tasks are executed.
All it needs is to change:
if ( strpos( $_SERVER['HTTP_HOST'], "playground.wordpress.net" ) !== false ) {
To:
if ( strpos( $_SERVER['HTTP_HOST'] ?? '', "playground.wordpress.net" ) !== false ) {
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Errors when used with WP-CLI’ is closed to new replies.