xref: /PHP-5.5/Zend/tests/bug47343.phpt (revision db63e29a)
1--TEST--
2Bug #47343 (gc_collect_cycles causes a segfault when called within a destructor in one case)
3--FILE--
4<?php
5class A
6{
7	public function __destruct()
8	{
9		gc_collect_cycles();
10	}
11
12	public function getB()
13	{
14		$this->data['foo'] = new B($this);
15		$this->data['bar'] = new B($this);
16		// Return either of the above
17		return $this->data['foo'];
18	}
19}
20
21class B
22{
23	public function B($A)
24	{
25		$this->A = $A;
26	}
27
28	public function __destruct()
29	{
30	}
31}
32
33for ($i = 0; $i < 2; $i++)
34{
35	$Aobj = new A;
36	$Bobj = $Aobj->getB();
37	unset($Bobj);
38	unset($Aobj);
39}
40
41echo "DONE\n";
42?>
43--EXPECT--
44DONE
45