aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim/src/var.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-20 15:36:54 +0900
committernsfisis <nsfisis@gmail.com>2026-07-20 15:36:54 +0900
commit80228e0a3b883ccdf2d80ba544c01619a856ef9c (patch)
tree328494692631454d96cbab7196504afec9190e9d /crates/shirabe-php-shim/src/var.rs
parent85fb9b70f4f41ead644b24f98052e6ffd9699e48 (diff)
downloadphp-shirabe-80228e0a3b883ccdf2d80ba544c01619a856ef9c.tar.gz
php-shirabe-80228e0a3b883ccdf2d80ba544c01619a856ef9c.tar.zst
php-shirabe-80228e0a3b883ccdf2d80ba544c01619a856ef9c.zip
fix(advisory): treat int-keyed ignore entries as plain IDs
parseIgnoreWithApply distinguishes ['CVE-123' => 'reason'] from [0 => 'CVE-123'] by checking is_int($key) in PHP. AuditConfig only matched on the value's type, so a canonical-int-keyed string value was mistaken for an id => reason pair. Expose canonical_int_key from the php-shim to replicate PHP's key-canonicalization rule and unignore test_mixed_formats.
Diffstat (limited to 'crates/shirabe-php-shim/src/var.rs')
-rw-r--r--crates/shirabe-php-shim/src/var.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/shirabe-php-shim/src/var.rs b/crates/shirabe-php-shim/src/var.rs
index f0e55d53..513c3e88 100644
--- a/crates/shirabe-php-shim/src/var.rs
+++ b/crates/shirabe-php-shim/src/var.rs
@@ -79,7 +79,7 @@ fn serialize_float(f: f64) -> String {
/// Returns the integer a PHP array key string normalizes to, or None if the key stays a string.
/// PHP treats a key as an integer only when it is a canonical decimal integer: no leading `+`, no
/// redundant leading zeros, and within the platform integer range ("-0" is not canonical).
-fn canonical_int_key(key: &str) -> Option<i64> {
+pub fn canonical_int_key(key: &str) -> Option<i64> {
if key == "0" {
return Some(0);
}