From 8c316f2c5e93888f4b3a5b8c18df3373b54fa816 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 24 Jul 2026 20:22:58 +0900 Subject: fix(dependency-resolver): query real PHP for ext-* version/loaded checks Two shim gaps made the extension-related branches of solver-problem messages wrong: - phpversion($ext) with a non-empty extension can't be known statically (it's shirabe-php-shim's todo!()); Problem::get_missing_package_reason now calls shirabe_php_rpc::phpversion, the same RPC bridge platform::runtime::Runtime::get_extension_version already uses. - extension_loaded's hardcoded allowlist was missing "pcre", a mandatory always-compiled-in PHP extension, so ext-pcre was misreported as "missing from your system" instead of "disabled by your platform config" whenever a platform override disabled it. Also fix XdebugHandler::getAllIniFiles() always returning `[""]` (a php-runtime stub): create_extension_hint()'s early-return guard (`paths[0] empty && len==1`) fired unconditionally, silently dropping the entire "To enable extensions..." hint from every solver-problem message that mentions missing extensions. shirabe-external-packages can't depend on shirabe-php-rpc (shirabe-php-rpc already depends on shirabe-external-packages), so IniHelper::get_all() queries a new get_all_ini_files RPC command directly instead of going through the stub. This exposed that XdebugHandler is never constructed with a name because bin/composer's restart-without-Xdebug bootstrap was never ported to main.rs, making COMPOSER_ORIGINAL_INIS-driven behavior unreachable; documented with a TODO(phase-c) and updated ini_helper_test.rs's ignore reasons (and ignored test_with_no_ini, which only passed before by coincidence with the old stub's constant output) to match. --- crates/shirabe/tests/util/ini_helper_test.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/tests/util') diff --git a/crates/shirabe/tests/util/ini_helper_test.rs b/crates/shirabe/tests/util/ini_helper_test.rs index 76705a09..0b3835a0 100644 --- a/crates/shirabe/tests/util/ini_helper_test.rs +++ b/crates/shirabe/tests/util/ini_helper_test.rs @@ -43,6 +43,9 @@ fn set_env(paths: &[&str]) { } #[test] +#[ignore = "XdebugHandler is never constructed with a name (the bin/composer restart-without-Xdebug \ +bootstrap is unported, see TODO(phase-c) in shirabe's main.rs), so IniHelper::get_all() queries \ +the real PHP runtime directly instead of consulting COMPOSER_ORIGINAL_INIS"] fn test_with_no_ini() { let paths = [""]; @@ -55,8 +58,9 @@ fn test_with_no_ini() { } #[test] -#[ignore = "XdebugHandler::get_all_ini_files() is stubbed to always return [\"\"], ignoring \ -COMPOSER_ORIGINAL_INIS entirely"] +#[ignore = "XdebugHandler is never constructed with a name (the bin/composer restart-without-Xdebug \ +bootstrap is unported, see TODO(phase-c) in shirabe's main.rs), so IniHelper::get_all() queries \ +the real PHP runtime directly instead of consulting COMPOSER_ORIGINAL_INIS"] fn test_with_loaded_ini_only() { let paths = ["loaded.ini"]; @@ -65,8 +69,9 @@ fn test_with_loaded_ini_only() { } #[test] -#[ignore = "XdebugHandler::get_all_ini_files() is stubbed to always return [\"\"], ignoring \ -COMPOSER_ORIGINAL_INIS entirely"] +#[ignore = "XdebugHandler is never constructed with a name (the bin/composer restart-without-Xdebug \ +bootstrap is unported, see TODO(phase-c) in shirabe's main.rs), so IniHelper::get_all() queries \ +the real PHP runtime directly instead of consulting COMPOSER_ORIGINAL_INIS"] fn test_with_loaded_ini_and_additional() { let paths = ["loaded.ini", "one.ini", "two.ini"]; @@ -79,8 +84,9 @@ fn test_with_loaded_ini_and_additional() { } #[test] -#[ignore = "XdebugHandler::get_all_ini_files() is stubbed to always return [\"\"], ignoring \ -COMPOSER_ORIGINAL_INIS entirely"] +#[ignore = "XdebugHandler is never constructed with a name (the bin/composer restart-without-Xdebug \ +bootstrap is unported, see TODO(phase-c) in shirabe's main.rs), so IniHelper::get_all() queries \ +the real PHP runtime directly instead of consulting COMPOSER_ORIGINAL_INIS"] fn test_without_loaded_ini_and_additional() { let paths = ["", "one.ini", "two.ini"]; -- cgit v1.3.1