0

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
    In the "Related" list here in the right sidebar, we can find a similar question: wp-cli displays php notices when display errors off where the problem seems to be the log_error settings for the OP. – birgire Nov 27 '16 at 23:43
  • Does --quiet=true do what you need? – Scotty Jakes Nov 28 '16 at 2:50
  • @birgire, yes, this was the problem. I have set log_errors = Off and it helped ! – Marin Bînzari Nov 28 '16 at 7:42
  • @ScottyJakes, the --quiet=true didn't help :( – Marin Bînzari Nov 28 '16 at 7:43
  • @birgire, please add your comment as an answer so I could accept it. – Marin Bînzari Nov 28 '16 at 8:15
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.