From 4805053a2b519ac984f3ee0ee449e9fc1271f9cf Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 4 Aug 2026 05:07:20 +0900 Subject: fix(package): keep list-shaped license arrays in ValidatingArrayLoader PHP's `(array)` cast passes an array through unchanged, but the port only matched the map shape and wrapped a JSON list (e.g. ["MIT"]) as a single license value, which then failed the is-string check and was silently dropped from composer.lock / installed.json with a bogus warning. Co-Authored-By: Claude Fable 5 --- crates/shirabe/src/package/loader/validating_array_loader.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'crates/shirabe') diff --git a/crates/shirabe/src/package/loader/validating_array_loader.rs b/crates/shirabe/src/package/loader/validating_array_loader.rs index 9ab7d583..0be0ef38 100644 --- a/crates/shirabe/src/package/loader/validating_array_loader.rs +++ b/crates/shirabe/src/package/loader/validating_array_loader.rs @@ -195,8 +195,15 @@ impl LoaderInterface for ValidatingArrayLoader { let license_val = self.config.borrow()["license"].clone(); // validate main data types if is_array(&license_val) || is_string(&license_val) { + // PHP: `(array) $this->config['license']` — an array (list-shaped included) + // stays as-is; only a scalar is wrapped. let mut licenses: IndexMap = match &license_val { PhpMixed::Array(m) => m.clone(), + PhpMixed::List(items) => items + .iter() + .enumerate() + .map(|(i, v)| (i.to_string(), v.clone())) + .collect(), other => { let mut m = IndexMap::new(); m.insert("0".to_string(), other.clone()); -- cgit v1.3.1