Annotation of embedaddon/php/ext/json/tests/003.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: json_encode() & endless loop - 1
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("json")) print "skip"; ?>
! 5: --FILE--
! 6: <?php
! 7:
! 8: $a = array();
! 9: $a[] = &$a;
! 10:
! 11: var_dump($a);
! 12: var_dump(json_encode($a));
! 13:
! 14: /* Break circular data structure to prevent memory leaks */
! 15: unset($a[0]);
! 16:
! 17: echo "Done\n";
! 18: ?>
! 19: --EXPECTF--
! 20: array(1) {
! 21: [0]=>
! 22: &array(1) {
! 23: [0]=>
! 24: *RECURSION*
! 25: }
! 26: }
! 27:
! 28: Warning: json_encode(): recursion detected in %s on line %d
! 29: string(8) "[[null]]"
! 30: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>