xref: /PHP-5.3/Zend/tests/gc_030.phpt (revision e24fff2d)
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 'Exception' with message '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 'Exception' with message 'foobar' in %sgc_030.php:%d
30Stack trace:
31#0 %sgc_030.php(%d): foo->__destruct()
32#1 {main}
33  thrown in %sgc_030.php on line %d
34