xref: /PHP-7.0/Zend/tests/gc_023.phpt (revision e24fff2d)
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--EXPECT--
25int(0)
26int(9999)
27int(0)
28int(1)
29ok
30