php-src/ext/spl/tests/splfixedarray_json_encode.phpt
Nikita Popov 805471e86b Fix bug #81112: Implement JsonSerializable for SplFixedArray
This returns an array for SplFixedArray JSON encoding, which
is more appropriate than an object with integer string keys.

Closes GH-7117.
2021-06-14 10:07:45 +02:00

18 lines
264 B
PHP

--TEST--
json_encode() on SplFixedArray
--FILE--
<?php
echo json_encode(new SplFixedArray()) . "\n";
echo json_encode(new SplFixedArray(1)) . "\n";
$a = new SplFixedArray(3);
$a[0] = 0;
$a[2] = 2;
echo json_encode($a) . "\n";
?>
--EXPECT--
[]
[null]
[0,null,2]