xref: /php-src/Zend/tests/gc/gc_030.phpt (revision 275f63e7)
1--TEST--
2GC 030: GC and exceptions in destructors
3--INI--
4zend.enable_gc=1
5--FILE--
6<?php
7class foo {
8    public $foo;
9
10    public function __destruct() {
11        throw new Exception("foobar");
12    }
13}
14
15$f1 = new foo;
16$f2 = new foo;
17$f1->foo = $f2;
18$f2->foo = $f1;
19unset($f1, $f2);
20gc_collect_cycles();
21?>
22--EXPECTF--
23Fatal error: Uncaught Exception: foobar in %sgc_030.php:%d
24Stack trace:
25#0 [internal function]: foo->__destruct()
26#1 %sgc_030.php(%d): gc_collect_cycles()
27#2 {main}
28
29Next Exception: foobar in %sgc_030.php:%d
30Stack trace:
31#0 [internal function]: foo->__destruct()
32#1 %sgc_030.php(%d): gc_collect_cycles()
33#2 {main}
34  thrown in %sgc_030.php on line %d
35