aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-rpc
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-10 08:45:18 +0900
committernsfisis <nsfisis@gmail.com>2026-08-10 08:45:18 +0900
commit6066087795efe76357f929bc1148deb1835cbbae (patch)
tree2032c9f983d7c73722cf9afc8376a8412ce0a82f /crates/shirabe-php-rpc
parent96fcd5ef671579b5b75e01de99bbe54d8c1e877b (diff)
downloadphp-shirabe-6066087795efe76357f929bc1148deb1835cbbae.tar.gz
php-shirabe-6066087795efe76357f929bc1148deb1835cbbae.tar.zst
php-shirabe-6066087795efe76357f929bc1148deb1835cbbae.zip
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-rpc')
-rw-r--r--crates/shirabe-php-rpc/src/lib.rs13
1 files changed, 13 insertions, 0 deletions
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<String> {
}
}
+/// 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<String> {
+ 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