Skip to content

Commit c7a5859

Browse files
committed
Prove JsonPointer::remove() doesn't handle sequential arrays correctly
Bug: T349483
1 parent f4e5117 commit c7a5859

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/src/JsonPointerTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ public function testGetSetDeleteObject()
9696
$this->assertEquals(null, $s->one->two);
9797
}
9898

99+
public function testSequentialArrayIsPreserved()
100+
{
101+
$json = [ 'l1' => [ 0 => 'foo', 1 => 'bar', 2 => 'baz' ] ];
102+
JsonPointer::remove($json, ['l1', '1'], JsonPointer::TOLERATE_ASSOCIATIVE_ARRAYS);
103+
$this->assertSame('{"l1":["foo","baz"]}', json_encode($json));
104+
}
105+
99106
}
100107

101108
class Sample

0 commit comments

Comments
 (0)