summaryrefslogtreecommitdiff
path: root/Zend/tests/gc_033.phpt
blob: cc28fd6a106235d1082cdc66c9eb8d9868f59571 (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
30
--TEST--
GC 033: Crash in GC while run with phpspec
--INI--
zend.enable_gc = 1
--FILE--
<?php
$a = new stdClass();
$a->a = array();
$a->a[0] = new Stdclass();
$a->a[0]->a = $a;
$a->a[1] = &$a->a;

/* remove the self-reference array out of roots */
gc_collect_cycles();

/* do unset */
unset($a);

/* let's full the gc roots */
for ($i=0; $i<9999; $i++) {
        $b = range(0, 1);
            $b[0] = &$b;
            unset($b);
}

/* then $a will be freed, but $a->a[0] is not. reference to a freed $a */
var_dump(gc_collect_cycles());
?>
--EXPECT--
int(10002)