diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-09 07:36:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-09 07:36:40 +0900 |
| commit | 627aaead32dcf38bed255012fcf7965d9553f52e (patch) | |
| tree | 1dd58c19edb8b7d37aa30ac3593b8e1f608b8c32 /crates | |
| parent | f1d65c337c63b6aa3582aabc64bfbbb2f949127c (diff) | |
| download | php-shirabe-627aaead32dcf38bed255012fcf7965d9553f52e.tar.gz php-shirabe-627aaead32dcf38bed255012fcf7965d9553f52e.tar.zst php-shirabe-627aaead32dcf38bed255012fcf7965d9553f52e.zip | |
fix(dependency-resolver): query the PHP runtime for the php version
Problem reported the platform php version from the shim's compile-time
PHP_VERSION constant, and the shim's phpversion() hit todo!() for any
extension. Go through the RPC bridge instead, as PHP's
Composer\Platform\Runtime does, and drop the shim function that now has
no callers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/shirabe-php-shim/src/runtime.rs | 10 | ||||
| -rw-r--r-- | crates/shirabe/src/dependency_resolver/problem.rs | 8 |
2 files changed, 3 insertions, 15 deletions
diff --git a/crates/shirabe-php-shim/src/runtime.rs b/crates/shirabe-php-shim/src/runtime.rs index 44cae087..ed159abb 100644 --- a/crates/shirabe-php-shim/src/runtime.rs +++ b/crates/shirabe-php-shim/src/runtime.rs @@ -185,16 +185,6 @@ pub fn get_loaded_extensions() -> Vec<String> { .collect() } -pub fn phpversion(_extension: &str) -> Option<String> { - if _extension.is_empty() { - Some(PHP_VERSION.to_string()) - } else { - // TODO(php-runtime): per-extension version strings are not modeled; PHP returns the extension's - // own version, or false when the extension is not loaded. - todo!() - } -} - // TODO(php-runtime): the callback should be registered in PHP runtime. pub fn set_error_handler(_callback: fn(i64, &str, &str, i64) -> bool) {} diff --git a/crates/shirabe/src/dependency_resolver/problem.rs b/crates/shirabe/src/dependency_resolver/problem.rs index 3b9feba5..63cbc6fb 100644 --- a/crates/shirabe/src/dependency_resolver/problem.rs +++ b/crates/shirabe/src/dependency_resolver/problem.rs @@ -14,8 +14,8 @@ use shirabe_external_packages::composer::pcre::{CaptureKey, Preg}; use shirabe_external_packages::symfony::console::formatter::OutputFormatter; use shirabe_php_shim::{ CmpOp, LogicException, PhpMixed, defined, extension_loaded, implode, loosely_compare, - php_regex, phpversion, spl_object_hash, sprintf, str_replace, str_starts_with, stripos, strpos, - strtolower, substr, substr_count, version_compare, + php_regex, spl_object_hash, sprintf, str_replace, str_starts_with, stripos, strpos, strtolower, + substr, substr_count, version_compare, }; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::MultiConstraint; @@ -389,7 +389,7 @@ impl Problem { let version = Self::get_platform_package_version( pool, package_name, - &phpversion("").unwrap_or_default(), + &shirabe_php_rpc::phpversion("").unwrap_or_default(), ); let msg = format!( @@ -456,8 +456,6 @@ impl Problem { Self::constraint_to_text(constraint) ); - // Per-extension version info can't be known statically; query the real PHP - // runtime via the RPC bridge, as PHP's Composer\Platform\Runtime does. let runtime_version = shirabe_php_rpc::phpversion(&ext); let effective_version = match runtime_version { None => "0".to_string(), |
