summaryrefslogtreecommitdiff
path: root/Zend/tests/bug47343.phpt
blob: f6168acf749f15b38f517b353f02659f476f6412 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--TEST--
Bug #47343 (gc_collect_cycles causes a segfault when called within a destructor in one case)
--FILE--
<?php
class A
{
    public function __destruct()
    {
        gc_collect_cycles();
    }

    public function getB()
    {
        $this->data['foo'] = new B($this);
        $this->data['bar'] = new B($this);
        // Return either of the above
        return $this->data['foo'];
    }
}

class B
{
    public function __construct($A)
    {
        $this->A = $A;
    }

    public function __destruct()
    {
    }
}

for ($i = 0; $i < 2; $i++)
{
    $Aobj = new A;
    $Bobj = $Aobj->getB();
    unset($Bobj);
    unset($Aobj);
}

echo "DONE\n";
?>
--EXPECT--
DONE