Automattic / Automattic/studio
Using Xdebug trace/profile modes
- Dominant language
- TypeScript
- Stars
- 517
- Forks
- 95
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 172
Description
# Summary
Currently, it is possible to enable Xdebug trace/profile modes in WordPress Studio's bundled PHP/WASM runtime, with usable but limited/unstable results.
Just patch two files:
- `/Applications/Studio.app/Contents/Resources/cli/node_modules/@php-wasm/node/index.js`
- `/Applications/Studio.app/Contents/Resources/cli/node_modules/@php-wasm/node/index.cjs`
In each, ensure `xdebug.mode` is set to `debug,develop,trace,profile`.
## Original parameters
Search for the following:
- `xdebug.mode=debug,develop`
## New parameters
Ensure the `trace` and `profile` parameters are added:
- `xdebug.mode=debug,develop,trace,profile`
## After making this change...
1. Quit Studio completely.
2. Reopen Studio.
3. Restart the target site.
4. Re-enable Xdebug for the site if needed.
## How to verify:
Run a temporary REST diagnostic and confirm `xdebug_mode` includes:
- `trace`
- `profile`
Expected value:
- `debug,develop,trace,profile`
Then quit and reopen Studio.
## Caveats:
- This is a local app-bundle patch, not a project setting.
- A Studio update may overwrite it.
- It may affect all Studio sites that enable Xdebug.
- Profiling is usable for evidence, but it's not a stable benchmark harness.
## My experience:
Studio’s PHP-WASM runtime is unstable with trace/profile on some diagnostic requests. I hit worker crashes with `Error: null function or function signature mismatch` inside Studio’s `@php-wasm/universal` runtime.
Contributor guide
Research direction
Open the bundled files at /Applications/Studio.app/Contents/Resources/cli/node_modules/@php-wasm/node/index.js and index.cjs, then search for xdebug.mode=debug,develop. Update both occurrences and verify with a temporary REST diagnostic after restarting Studio, the target site, and Xdebug; done means the reported value is debug,develop,trace,profile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, php, wasm
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100