/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/json/tests/json_encode_recursion_04.phpt
41 строка
762 B
Jakub Zelenka
Introduce Zend guard recursion protection
24 авг 2023, 15:03
Не верифицирован
24 авг 2023, 15:03
53aa53f
Код
Авторство
О чём код?
--TEST-- json_encode() Recursion test with JsonSerializable, __debugInfo and var_export --FILE-- <?php class SerializingTest implements JsonSerializable { public $a = 1; public function __debugInfo() { return [ 'result' => var_export($this, true) ]; } public function jsonSerialize(): mixed { var_dump($this); return $this; } } var_dump(json_encode(new SerializingTest())); echo "---------\n"; var_dump(new SerializingTest()); ?> --EXPECT-- object(SerializingTest)#1 (1) { ["result"]=> string(52) "\SerializingTest::__set_state(array( 'a' => 1, ))" } string(7) "{"a":1}" --------- object(SerializingTest)#1 (1) { ["result"]=> string(52) "\SerializingTest::__set_state(array( 'a' => 1, ))" }