diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-20 08:13:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-20 08:13:12 +0900 |
| commit | 087865ef50283350a3cc74a5363ba44fa7dbe5c5 (patch) | |
| tree | b27ded5001c46feb587839771347389f609a7c57 /crates/shirabe-php-rpc | |
| parent | a9dc11a1a0d8d442ab85b3eeb8791f2a8069d528 (diff) | |
| download | php-shirabe-087865ef50283350a3cc74a5363ba44fa7dbe5c5.tar.gz php-shirabe-087865ef50283350a3cc74a5363ba44fa7dbe5c5.tar.zst php-shirabe-087865ef50283350a3cc74a5363ba44fa7dbe5c5.zip | |
feat(php-rpc): implement phpinfo() capture over RPC
DiagnoseCommand::check_platform needed phpinfo() output but
shirabe-php-shim's ob_start()/phpinfo()/ob_get_clean() are unmodeled
todo!()s. Add a phpinfo dispatch entry to the PHP worker (capturing
output the same way extension_info already does) and a get_phpinfo()
wrapper, then switch check_platform to call it directly.
This unblocks the phpinfo-related panic in diagnose; the ignored
tests now hit a separate RefCell double-borrow bug in check_http, so
their ignore reasons are updated to point at that instead.
Diffstat (limited to 'crates/shirabe-php-rpc')
| -rw-r--r-- | crates/shirabe-php-rpc/php/worker.php | 5 | ||||
| -rw-r--r-- | crates/shirabe-php-rpc/src/lib.rs | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/crates/shirabe-php-rpc/php/worker.php b/crates/shirabe-php-rpc/php/worker.php index cb2bf48d..d7d8f251 100644 --- a/crates/shirabe-php-rpc/php/worker.php +++ b/crates/shirabe-php-rpc/php/worker.php @@ -22,6 +22,11 @@ $dispatch = [ $re->info(); return (string) ob_get_clean(); }, + 'phpinfo' => static function ($what) { + ob_start(); + phpinfo((int) $what); + return (string) ob_get_clean(); + }, ]; $read_exact = static function ($conn, int $len): ?string { $buf = ''; diff --git a/crates/shirabe-php-rpc/src/lib.rs b/crates/shirabe-php-rpc/src/lib.rs index d5d1dafa..9ba02629 100644 --- a/crates/shirabe-php-rpc/src/lib.rs +++ b/crates/shirabe-php-rpc/src/lib.rs @@ -58,6 +58,14 @@ pub fn get_extension_info(name: &str) -> String { } } +/// PHP `phpinfo($what)` output, captured via `ob_start()`/`ob_get_clean()`. +pub fn get_phpinfo(what: i64) -> String { + match call("phpinfo", &what.to_string()) { + PhpMixed::String(s) => s, + other => panic!("PHP RPC: `phpinfo` did not return a string: {other:?}"), + } +} + /// PHP `phpversion($extension)`. pub fn phpversion(extension: &str) -> Option<String> { match call("phpversion", extension) { |
