xref: /php-src/Zend/tests/gc/gc_023.phpt (revision 275f63e7)
1--TEST--
2GC 023: Root buffer overflow (automatic collection)
3--INI--
4zend.enable_gc=1
5--FILE--
6<?php
7$a=array();
8for ($i=0; $i < 9999; $i++) {
9    $a[$i] = array(array());
10    $a[$i][0] = & $a[$i];
11}
12var_dump(gc_collect_cycles());
13unset($a);
14var_dump(gc_collect_cycles());
15$a=array();
16for ($i=0; $i < 10001; $i++) {
17    $a[$i] = array(array());
18    $a[$i][0] = & $a[$i];
19}
20var_dump(gc_collect_cycles());
21unset($a); // 10000 zvals collected automatic
22var_dump(gc_collect_cycles());
23echo "ok\n";
24?>
25--EXPECT--
26int(0)
27int(9999)
28int(0)
29int(1)
30ok
31