From 6066087795efe76357f929bc1148deb1835cbbae Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 10 Aug 2026 08:45:18 +0900 Subject: refactor(autoload): resolve include_path in the PHP worker ClassLoader's PSR-0 include_path lookup went through a shim stub that could only have answered with an invented include_path: the setting is PHP runtime state, and the one thing that turns useIncludePath on is the generated autoload_real.php, whose set_include_path() call runs inside the worker. Ask the worker instead, so the search sees the same path list as the process that ends up including the resolved file. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-php-rpc/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'crates/shirabe-php-rpc/src/lib.rs') diff --git a/crates/shirabe-php-rpc/src/lib.rs b/crates/shirabe-php-rpc/src/lib.rs index 1b165cfa..b11351e6 100644 --- a/crates/shirabe-php-rpc/src/lib.rs +++ b/crates/shirabe-php-rpc/src/lib.rs @@ -537,6 +537,19 @@ pub fn phpversion(extension: &str) -> Option { } } +/// PHP `stream_resolve_include_path($filename)`. It is answered by the worker because the +/// `include_path` it searches is the worker's own, including whatever a required `autoload_real.php` +/// put there with `set_include_path()`. +pub fn stream_resolve_include_path(filename: &str) -> Option { + match call("stream_resolve_include_path", filename) { + PhpMixed::String(s) => Some(s), + PhpMixed::Bool(false) => None, + other => { + panic!("PHP RPC: `stream_resolve_include_path` returned an unexpected value: {other:?}") + } + } +} + /// What `Composer\XdebugHandler\XdebugHandler::getAllIniFiles()` measures: `[(string) /// php_ini_loaded_file()]` merged with the trimmed, comma-split `php_ini_scanned_files()` list /// when scanning is active. The worker runs on the ini files of the machine, so these are the -- cgit v1.3.1-4-g156e