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