PHP warning are displaying when using WP CLI [closed]

I’m running WP CLI 0.25.0 on Debian, PHP 7.0. I keep getting the PHP warnings displayed. In php.ini used for cli I have set error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING (and checked the change), but no difference, the warning is output.

Ran WP CLI with --debug=false, still no effect.

How to suppress the warning display, as it breaks the JSON output ?

Edit 1

Before using error_log = Off :

PHP Warning: Invalid argument supplied for foreach() in /var/…/theme-settings.php on line 2805
Warning: Invalid argument supplied for foreach() in /var/…/theme-settings.php on line 2805

Using error_log = Off :

Warning: Invalid argument supplied for foreach() in /var/…/theme-settings.php on line 2805

Pay attention that the PHP Warning disapeared, and theres the Warning left.

1 Answer
1

The first thing to check for this issue is the WP_DEBUG, WP_DEBUG_LOG and WP_DEBUG_DISPLAY constants in the wp-config.php file. They have to be set to false or be commented out (the default value is false). Else, no matter which global log_errors, display_errors or error_reporting settings you have, you will still see those warnings when running wp-cli.

Leave a Comment