Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Dec 10, 2025

Summary

Ensures that PHP.js never implicitly calls child_process.spawn(). Either it does that through an explicit spawn handler, or it throws an error. I've just spent two hours figuring out why is spawn() being called and it turns out I wasn't attaching the spawn handler correctly. An explicit error message would solve that quickly, and spawn is easy to attach as a spawn handler so let's make that semantics opt-in.

Test plan

CI

Previously, the PHP.wasm emscripten library would automatically use Node.js
child_process.spawn() when running in a Node environment. This implicit
behavior made it difficult to control and customize process spawning.

This change removes the automatic fallback and requires consumers to explicitly
call php.setSpawnHandler() to enable proc_open(), popen(), and similar functions.
The CLI now sets up the spawn handler explicitly, making the spawning behavior
opt-in rather than implicit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants