xref: /PHP-7.0/ext/json/tests/bug72069.phpt (revision 589d0e0f)
1--TEST--
2Bug #72069 (Behavior \JsonSerializable different from json_encode)
3--SKIPIF--
4<?php if (!extension_loaded("json")) print "skip"; ?>
5--FILE--
6<?php
7
8$result = json_encode(['end' => json_decode(null, true)]);
9var_dump($result);
10
11class A implements \JsonSerializable
12{
13	function jsonSerialize()
14	{
15		return ['end' => json_decode(null, true)];
16	}
17}
18$a = new A();
19$toJsonData = $a->jsonSerialize();
20$result = json_encode($a);
21var_dump($result);
22
23$result = json_encode($toJsonData);
24var_dump($result);
25?>
26--EXPECT--
27string(12) "{"end":null}"
28string(12) "{"end":null}"
29string(12) "{"end":null}"
30