Annotation of embedaddon/php/ext/json/tests/004.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: json_encode() & endless loop - 2
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("json")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $a = new stdclass;
! 9: $a->prop = $a;
! 10:
! 11: var_dump($a);
! 12: var_dump(json_encode($a));
! 13:
! 14: echo "Done\n";
! 15: ?>
! 16: --EXPECTF--
! 17: object(stdClass)#%d (1) {
! 18: ["prop"]=>
! 19: *RECURSION*
! 20: }
! 21:
! 22: Warning: json_encode(): recursion detected in %s on line %d
! 23: string(22) "{"prop":{"prop":null}}"
! 24: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>