xref: /PHP-8.2/ext/json/tests/bug66025.phpt (revision 5beba0b0)
1--TEST--
2Bug #66025 (Indent wrong when json_encode() called from jsonSerialize function)
3--FILE--
4<?php
5
6class Foo implements JsonSerializable {
7    public function jsonSerialize(): mixed {
8        return json_encode([1], JSON_PRETTY_PRINT);
9    }
10}
11
12echo json_encode([new Foo]), "\n";
13?>
14--EXPECT--
15["[\n    1\n]"]
16