From 890a50de2a740cc4c4edba12b37cc9aa4d0efdc5 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 23 Aug 2026 12:36:15 +0900 Subject: fix(config-command): print config values PHP would stringify `config --list` and `config ` rendered a value with `as_string()`, which yields None for everything but a string, so every int-valued setting printed as an empty string: `cache-ttl`, `cache-files-ttl` and the resolved value of `cache-files-maxsize`. PHP builds that output by concatenating the value into the message, which casts it, so the ports now go through `php_to_string`. Two more differences in the same rendering path: The `[a, b]` branch flattened the array through `as_list()`, which sees only `PhpMixed::List`, so a keyed array reaching it rendered as `[]`. PHP takes that branch whenever the first key is numeric, so the values now come from `array_values_mixed`, which covers both representations. The raw-vs-resolved comparison deciding between `raw (value)` and `value` compared the two as strings. PHP compares with `!==`, which also compares the type: with a `cache-ttl` of `"15552000"` in composer.json, the raw string and the resolved int are not identical and Composer prints `15552000 (15552000)`. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-php-shim/src/array.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'crates/shirabe-php-shim/src/array.rs') diff --git a/crates/shirabe-php-shim/src/array.rs b/crates/shirabe-php-shim/src/array.rs index 3870d59e..ec9adb26 100644 --- a/crates/shirabe-php-shim/src/array.rs +++ b/crates/shirabe-php-shim/src/array.rs @@ -6,6 +6,14 @@ pub fn array_values(array: &IndexMap) -> Vec { array.values().cloned().collect() } +pub fn array_values_mixed(value: &PhpMixed) -> Vec { + match value { + PhpMixed::List(items) => items.clone(), + PhpMixed::Array(map) => map.values().cloned().collect(), + _ => panic!("array_values(): Argument #1 ($array) must be of type array"), + } +} + pub fn array_keys(array: &IndexMap) -> Vec { array.keys().cloned().collect() } -- cgit v1.3.1-4-g156e