mirror of
https://github.com/php/php-src.git
synced 2024-12-13 11:54:45 +08:00
82a4f1a1a2
Changed json_encode() so that when the JSON_PRETTY_PRINT option is specified, the pair of linefeeds immediately after an opening bracket and before the corresponding closing bracket is omitted when the array or object contains no elements or accessible properties (and hence would have a blank line between the brackets).
21 lines
320 B
PHP
21 lines
320 B
PHP
--TEST--
|
|
Bug #66021 (Blank line inside empty array/object when JSON_PRETTY_PRINT is set)
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("json")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
class Foo {
|
|
private $bar = 'baz';
|
|
}
|
|
|
|
echo json_encode([[], (object)[], new Foo], JSON_PRETTY_PRINT), "\n";
|
|
|
|
?>
|
|
--EXPECT--
|
|
[
|
|
[],
|
|
{},
|
|
{}
|
|
]
|