-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support proc_open(), exec(), passthru(), system() (#596)
## Description Adds [support for proc_open(), popen($cmd, "w"), exec(), passthru(), system()](b4cfb8c) via a custom spawn handler defined in JavaScript via `php.setSpawnHandler()`. ### `proc_open()` This PR patches PHP to replace C calls to `proc_open()` with a custom implementation provided with a new `proc_open7.0.c`/`proc_open7.4.c` file. The original `proc_open()` relies on POSIX `fork()` function not available in WebAssembly, so which is why this PR defers the command execution to the `setSpawnHandler()` callback provided via JavaScript. ### `exec()`, `passthru()`, `system()` This PR provides a custom `php_exec` implementation (via the `wasm_php_exec` C function). `php_exec` is the function powering PHP functions like `exec()`, `passthru()`, `system()`. ### `popen()` The existing `popen()` implementation is rewired to call the `setSpawnHandler()` callback. Also, the support for the `popen($cmd, "w")` mode was added. ### Other notes This PR removes support for PHP 5.6 as supporting these functions was challenging there AND also WordPress dropped the support for PHP 5.6. Closes #594 Closes #710
- Loading branch information
Showing
43 changed files
with
6,187 additions
and
3,513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ export default defineConfig(() => { | |
'net', | ||
'fs', | ||
'path', | ||
'child_process', | ||
'http', | ||
'tls', | ||
'util', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.