diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-04 05:07:20 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-04 05:43:28 +0900 |
| commit | 4805053a2b519ac984f3ee0ee449e9fc1271f9cf (patch) | |
| tree | 798eb4c21ec7330527991f279a5d44ea33a486a9 /crates/shirabe/src/package/loader | |
| parent | 3f3ad76eafcc5513000ac7526c74c2009bb390d8 (diff) | |
| download | php-shirabe-4805053a2b519ac984f3ee0ee449e9fc1271f9cf.tar.gz php-shirabe-4805053a2b519ac984f3ee0ee449e9fc1271f9cf.tar.zst php-shirabe-4805053a2b519ac984f3ee0ee449e9fc1271f9cf.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/package/loader')
| -rw-r--r-- | crates/shirabe/src/package/loader/validating_array_loader.rs | 7 |
1 files changed, 7 insertions, 0 deletions
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<String, PhpMixed> = 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()); |
