Skip to content

Keep PHP diagnostics out of WP-CLI stdout - #4731

Open
chubes4 wants to merge 1 commit into
trunkfrom
fix/4686-php-diagnostics-stdout
Open

Keep PHP diagnostics out of WP-CLI stdout#4731
chubes4 wants to merge 1 commit into
trunkfrom
fix/4686-php-diagnostics-stdout

Conversation

@chubes4

@chubes4 chubes4 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

OpenAI gpt-5.6-sol, via OpenCode general coding subagent, reproduced PHP 8.5 deprecations on studio wp stdout, compared run-wp-cli-command with the reprint runner PHP ini policy, implemented the launcher-level fix, added focused tests, ran lint/test gates, and opened this PR under human direction.

Proposed Changes

studio wp can emit PHP 8.5 deprecations on stdout before command output, which corrupts machine-readable JSON and other parsed results even when WP-CLI itself succeeds.

The reprint runner already suppresses E_DEPRECATED and routes displayed errors to stderr. This PR applies that same PHP ini policy at the WP-CLI launcher so native -d flags and Playground setPhpIniEntries keep stdout strictly parseable.

Testing Instructions

  • npm test -- apps/cli/lib/tests/wp-cli-php-ini.test.ts
  • On a native PHP 8.5 Studio site, run studio wp plugin list --format=json (after a CLI build that includes this change) and confirm stdout is valid JSON with no Deprecated: prefix. Diagnostics, if any, belong on stderr.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

PHP 8.5 deprecations from bundled WP-CLI code were written to stdout,
which breaks machine-readable JSON and other parsed command output.
Apply the reprint runner ini policy so WP-CLI launchers send diagnostics
to stderr (and suppress E_DEPRECATED) on both native and Playground paths.
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 360fd86 vs trunk

app-size

Metric trunk 360fd86 Diff Change
App Size (Mac) 1422.63 MB 1422.63 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 360fd86 Diff Change
load 1192 ms 1257 ms +65 ms 🔴 5.5%

site-startup

Metric trunk 360fd86 Diff Change
siteCreation 7491 ms 7530 ms +39 ms ⚪ 0.0%
siteStartup 3372 ms 3377 ms +5 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep PHP diagnostics out of WP-CLI stdout

2 participants