From 78fd15c4cb61d6422e80bcf406f3a67c63efd760 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Mon, 30 Sep 2024 04:13:14 -0400 Subject: [PATCH] Test that PackedArray::fromJSON() accepts objects with valid keys (#1703) 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===