File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1
1
--TEST--
2
2
GC 029: GC and destructors
3
+ --SKIPIF--
4
+ <?php if (PHP_ZTS ) { print "skip only for no-zts build " ; }
3
5
--INI --
4
6
zend.enable_gc=1
5
7
--FILE --
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GC 029: GC and destructors
3
+ --SKIPIF--
4
+ <?php if (!PHP_ZTS ) { print "skip only for zts build " ; }
5
+ --INI --
6
+ zend.enable_gc=1
7
+ --FILE --
8
+ <?php
9
+ class Foo {
10
+ public $ bar ;
11
+ public $ x = array (1 ,2 ,3 );
12
+ function __destruct () {
13
+ if ($ this ->bar !== null ) {
14
+ $ this ->x = null ;
15
+ unset($ this ->bar );
16
+ }
17
+ }
18
+ }
19
+ class Bar {
20
+ public $ foo ;
21
+ function __destruct () {
22
+ if ($ this ->foo !== null ) {
23
+ unset($ this ->foo );
24
+ }
25
+ }
26
+
27
+ }
28
+ $ foo = new Foo ();
29
+ $ bar = new Bar ();
30
+ $ foo ->bar = $ bar ;
31
+ $ bar ->foo = $ foo ;
32
+ unset($ foo );
33
+ unset($ bar );
34
+ var_dump (gc_collect_cycles ());
35
+ ?>
36
+ --EXPECT--
37
+ int(3)
You can’t perform that action at this time.
0 commit comments