1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00
Files
archived-php-src/ext/json/tests/bug72069.phpt
2020-05-28 15:07:47 -04:00

28 lines
547 B
PHP

--TEST--
Bug #72069 (Behavior \JsonSerializable different from json_encode)
--FILE--
<?php
$result = json_encode(['end' => json_decode(null, true)]);
var_dump($result);
class A implements \JsonSerializable
{
function jsonSerialize()
{
return ['end' => json_decode(null, true)];
}
}
$a = new A();
$toJsonData = $a->jsonSerialize();
$result = json_encode($a);
var_dump($result);
$result = json_encode($toJsonData);
var_dump($result);
?>
--EXPECT--
string(12) "{"end":null}"
string(12) "{"end":null}"
string(12) "{"end":null}"