admin管理员组

文章数量:1315318

Closed. This question is off-topic. It is not currently accepting answers.

Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?

Closed 4 years ago.

Improve this question

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.

Closed. This question is off-topic. It is not currently accepting answers.

Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?

Closed 4 years ago.

Improve this question

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.

Share Improve this question edited Nov 29, 2016 at 12:47 Marin Bînzari asked Nov 27, 2016 at 22:51 Marin BînzariMarin Bînzari 1,05213 silver badges20 bronze badges 7
  • 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 Commented Nov 27, 2016 at 23:43
  • Does --quiet=true do what you need? – Scotty Jakes Commented Nov 28, 2016 at 2:50
  • @birgire, yes, this was the problem. I have set log_errors = Off and it helped ! – Marin Bînzari Commented Nov 28, 2016 at 7:42
  • @ScottyJakes, the --quiet=true didn't help :( – Marin Bînzari Commented Nov 28, 2016 at 7:43
  • @birgire, please add your comment as an answer so I could accept it. – Marin Bînzari Commented Nov 28, 2016 at 8:15
 |  Show 2 more comments

1 Answer 1

Reset to default 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.

本文标签: wp cliPHP warning are displaying when using WP CLI