Dev Tools · 1h ago
Three-layer fix silences PHP 8.2 deprecation noise in WP-CLI JSON output
A multi-site maintenance tool failed when `wp plugin list --format=json` returned mixed output due to PHP 8.2+ deprecation warnings leaking into stdout. The root cause was older WP-CLI 2.x using dynamic properties, with `display_errors` sending warnings to stdout instead of stderr. The fix uses three layers: `WP_CLI_PHP_ARGS` to suppress warnings, output filtering to strip non-JSON lines, and fallback parsing to handle partial JSON.
Meridian48 take
This is a practical debugging case study for developers maintaining legacy toolchains, but the core lesson—that diagnostics can pass while structured output breaks—is broadly applicable.
Read the full reporting
Quieting PHP 8.2+ deprecated noise from older WP-CLI — three layers to keep JSON parse clean →
DEV Community
php-8.2wp-cli