diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-26 00:18:54 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-26 00:18:54 +0900 |
| commit | ed0da7fcc3056ce5a822ac0de63ccc2dc799006e (patch) | |
| tree | 8689fb2797c3d9ced9b89a54753ad5d780c32cd5 /docs | |
| parent | f642329554cf18734e671dc4758bc045de489999 (diff) | |
| download | php-shirabe-ed0da7fcc3056ce5a822ac0de63ccc2dc799006e.tar.gz php-shirabe-ed0da7fcc3056ce5a822ac0de63ccc2dc799006e.tar.zst php-shirabe-ed0da7fcc3056ce5a822ac0de63ccc2dc799006e.zip | |
feat(diagnose-command): query the real PHP runtime in one RPC call
diagnose used to read hardcoded shim stubs, so it described a fictional
runtime: OPENSSL_VERSION_NUMBER was always 0 and tripped the TLSv1.1/1.2
check, PHP_BINARY and OPENSSL_VERSION_TEXT were empty, and the extension,
function and ini probes answered from a fixed table.
The PHP worker gained a `diagnose` entry that returns every fact the
command needs as one PHP array, cached in a OnceLock so the several call
sites share a single round trip. Reading it back needed array support in
the serialize() parser, which in turn lets get_loaded_extensions and
get_all_ini_files return real lists instead of comma-joined strings.
Also fixes the openssl_version message, which dropped strstr()'s
before_needle argument during the port, and check_connectivity's
allow_url_fopen test, which did not follow PHP string truthiness.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/dev/php-rpc.md | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/docs/dev/php-rpc.md b/docs/dev/php-rpc.md index 1ec81710..6e0bc40c 100644 --- a/docs/dev/php-rpc.md +++ b/docs/dev/php-rpc.md @@ -10,12 +10,12 @@ system PHP as a child process and asks it for runtime information over a Unix do The crate supports exactly one interaction pattern, and nothing else: -> Rust calls a named PHP function, passing a single string argument, and receives a single scalar +> Rust calls a named PHP function, passing a single string argument, and receives a single value > back. - Rust to PHP only. PHP never calls back into Rust. - Exactly one argument, and it must be a string. -- Scalar return values only (string / int / float / bool / null). +- Return values are scalars (string / int / float / bool / null) or arrays of them. - Every failure `panic!`s: a PHP exception (not currently possible — the glue script never lets one escape), a serialization/deserialization failure, a missing PHP function, a crashed child, etc. None are handled as recoverable errors. This is not the final design — a future revision @@ -35,8 +35,7 @@ Reuse the existing `PhpExecutableFinder` class to resolve the PHP binary. - Request payload: the PHP function name as raw bytes, followed by a `\0` byte and the string argument (function names are static literals and never contain `\0`, so the first `\0` unambiguously separates name from argument). - - Response payload: `serialize()` of the function's return value — any of `N;` (null), `b:0/1;` - (bool), `i:<n>;` (int), `d:<f>;` (float), or `s:<len>:"<bytes>";` (string). + - Response payload: `serialize()` of the function's return value. The PHP worker is a single read-eval-respond loop: read a framed function name and argument, call the matching entry in a fixed dispatch table (`defined`, `constant`), send back |
