From 1b504cf64701f647addb09ea39a256616bec3df3 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Fri, 27 Sep 2024 10:26:37 -0400 Subject: [PATCH] Test that PackedArray::fromJSON() accepts objects with valid keys https://jira.mongodb.org/browse/PHPC-2350 --- tests/bson/bson-packedarray-fromJSON-001.phpt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/bson/bson-packedarray-fromJSON-001.phpt b/tests/bson/bson-packedarray-fromJSON-001.phpt index 647a919aa..6cda931ca 100644 --- a/tests/bson/bson-packedarray-fromJSON-001.phpt +++ b/tests/bson/bson-packedarray-fromJSON-001.phpt @@ -10,6 +10,8 @@ $tests = [ '[ 1, 2, 3 ]', '[[ 1, 2, 3 ]]', '[{ "bar": 1 }]', + // JSON objects are accepted iff the keys are valid + '{ "0": "foo", "1": "bar" }', ]; foreach ($tests as $json) { @@ -34,4 +36,7 @@ Test [[ 1, 2, 3 ]] Test [{ "bar": 1 }] 0 : 16 00 00 00 03 30 00 0e 00 00 00 10 62 61 72 00 [.....0......bar.] 10 : 01 00 00 00 00 00 [......] +Test { "0": "foo", "1": "bar" } + 0 : 1b 00 00 00 02 30 00 04 00 00 00 66 6f 6f 00 02 [.....0.....foo..] + 10 : 31 00 04 00 00 00 62 61 72 00 00 [1.....bar..] ===DONE===