Skip to content

Commit c79d5b8

Browse files
Jurynikic
authored andcommitted
Adds json_encode test for unpacked arrays
1 parent c68dc6b commit c79d5b8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ext/json/tests/009.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
json_encode() with non-packed array that should be encoded as an array rather than object
3+
--SKIPIF--
4+
<?php if (!extension_loaded("json")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
$a = array(1, 2, 3, 'foo' => 'bar');
8+
unset($a['foo']);
9+
10+
var_dump(json_encode($a));
11+
echo "Done\n";
12+
?>
13+
--EXPECT--
14+
string(7) "[1,2,3]"
15+
Done
16+

0 commit comments

Comments
 (0)