From ed0da7fcc3056ce5a822ac0de63ccc2dc799006e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 26 Jul 2026 00:18:54 +0900 Subject: 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) --- crates/shirabe-php-shim/src/string.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'crates/shirabe-php-shim') diff --git a/crates/shirabe-php-shim/src/string.rs b/crates/shirabe-php-shim/src/string.rs index ba45bc8b..dc566bec 100644 --- a/crates/shirabe-php-shim/src/string.rs +++ b/crates/shirabe-php-shim/src/string.rs @@ -380,6 +380,16 @@ pub fn strstr(haystack: &str, needle: &str) -> Option { haystack.find(needle).map(|i| haystack[i..].to_string()) } +pub fn strstr3(haystack: &str, needle: &str, before_needle: bool) -> Option { + haystack.find(needle).map(|i| { + if before_needle { + haystack[..i].to_string() + } else { + haystack[i..].to_string() + } + }) +} + /// PHP's default trim character mask: " \t\n\r\0\x0B". const PHP_TRIM_DEFAULT_CHARS: &[u8] = b" \t\n\r\0\x0B"; -- cgit v1.3.1