diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-20 23:37:42 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-20 23:37:42 +0900 |
| commit | 84655bf3a4a21dbbe7aec8e3aee1e661505bbb6d (patch) | |
| tree | 189f8ce5d7d53246632d5e2419c392d58f06e2b8 /crates/shirabe-php-shim | |
| parent | 10840ec1fd7f1140305449fc94175d60998572c1 (diff) | |
| download | php-shirabe-84655bf3a4a21dbbe7aec8e3aee1e661505bbb6d.tar.gz php-shirabe-84655bf3a4a21dbbe7aec8e3aee1e661505bbb6d.tar.zst php-shirabe-84655bf3a4a21dbbe7aec8e3aee1e661505bbb6d.zip | |
feat(symfony-process): port full Process class from PHP
Faithfully port every method, field and constant of Symfony's
Process.php into process.rs, replacing the reduced stub. Add the
supporting pipes module (PipesInterface/AbstractPipes/UnixPipes/
WindowsPipes), ProcessUtils and the missing process exceptions
(LogicException/InvalidArgumentException) with constructors.
Methods now return anyhow::Result where PHP throws, take the env
argument and a bool-returning callback, and borrow &mut for
status-updating accessors; all callers are updated accordingly.
Extend the php-shim with proc_open/proc_close (PHP-compatible
signatures), proc_get_status, proc_terminate, posix_kill, uniqid,
ftruncate, ftell_stream, fseek3, stream_get_contents3 and env
helpers.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim')
| -rw-r--r-- | crates/shirabe-php-shim/src/lib.rs | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/crates/shirabe-php-shim/src/lib.rs b/crates/shirabe-php-shim/src/lib.rs index 4bb309e..b85d9f2 100644 --- a/crates/shirabe-php-shim/src/lib.rs +++ b/crates/shirabe-php-shim/src/lib.rs @@ -3467,16 +3467,63 @@ pub fn stdin() -> PhpResource { PhpResource::Stdin } -// TODO(phase-c): reports proc_open as unavailable, so callers (terminal size and -// tty detection) fall back to their defaults. A real implementation requires a -// non-lossy signature able to hold the child process and its pipes; defer it to -// the broader process-subsystem work (ProcessExecutor). -pub fn proc_open(_command: &str, _descriptorspec: &Vec<PhpMixed>, _pipes: &mut PhpMixed) -> bool { - false +// TODO(phase-c): reports proc_open as unavailable (returns false), so callers fall back to +// their defaults. A real implementation requires holding the child process and its pipes; defer +// it to the broader process-subsystem work (ProcessExecutor). +pub fn proc_open( + _command: &str, + _descriptorspec: &[PhpMixed], + _pipes: &mut PhpMixed, + _cwd: Option<&str>, + _env: Option<&[String]>, + _options: Option<&IndexMap<String, PhpMixed>>, +) -> PhpMixed { + PhpMixed::Bool(false) } -pub fn proc_close(_process: bool) -> i64 { +pub fn proc_close(_process: PhpMixed) -> i64 { -1 } +pub fn proc_get_status(_process: &PhpMixed) -> IndexMap<String, PhpMixed> { + todo!() +} +pub fn proc_terminate(_process: &PhpMixed, _signal: i64) -> bool { + todo!() +} +pub fn posix_kill(_pid: i64, _signal: i64) -> bool { + todo!() +} +pub fn uniqid(_prefix: &str, _more_entropy: bool) -> String { + todo!() +} +pub fn ftruncate(_stream: &PhpMixed, _size: i64) -> bool { + todo!() +} +/// PHP `ftell()` over a PhpMixed stream resource. (`ftell` itself is already defined for the +/// `PhpResource`-typed stream API used elsewhere.) +pub fn ftell_stream(_stream: &PhpMixed) -> i64 { + todo!() +} +pub const SEEK_SET: i64 = 0; +pub const SEEK_CUR: i64 = 1; +pub const SEEK_END: i64 = 2; +pub fn fseek3(_stream: PhpMixed, _offset: i64, _whence: i64) -> i64 { + todo!() +} +pub fn stream_get_contents3(_stream: PhpMixed, _max_length: i64, _offset: i64) -> Option<String> { + todo!() +} +/// PHP `getenv()` with no argument: all environment variables. +pub fn getenv_all() -> IndexMap<String, String> { + todo!() +} +/// PHP superglobal `$_ENV`. +pub fn php_env() -> IndexMap<String, PhpMixed> { + todo!() +} +/// PHP superglobal `$_SERVER`. +pub fn php_server() -> IndexMap<String, PhpMixed> { + todo!() +} pub fn sapi_windows_vt100_support(_resource: &PhpResource) -> bool { todo!() |
