File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #78589: Memory leak with GC + __destruct()
3
+ --FILE--
4
+ <?php
5
+
6
+ class Test {
7
+ public function __destruct () {}
8
+ }
9
+
10
+ $ test = new Test ;
11
+ $ test ->foo = [&$ test ->foo ];
12
+ $ ary = [&$ ary , $ test ];
13
+ unset($ ary , $ test );
14
+ gc_collect_cycles ();
15
+
16
+ ?>
17
+ ===DONE===
18
+ --EXPECT--
19
+ ===DONE===
Original file line number Diff line number Diff line change @@ -1539,7 +1539,6 @@ ZEND_API int zend_gc_collect_cycles(void)
1539
1539
1540
1540
/* Destroy zvals */
1541
1541
GC_TRACE ("Destroying zvals" );
1542
- GC_G (gc_protected ) = 1 ;
1543
1542
current = GC_IDX2PTR (GC_FIRST_ROOT );
1544
1543
last = GC_IDX2PTR (GC_G (first_unused ));
1545
1544
while (current != last ) {
@@ -1590,7 +1589,6 @@ ZEND_API int zend_gc_collect_cycles(void)
1590
1589
1591
1590
GC_TRACE ("Collection finished" );
1592
1591
GC_G (collected ) += count ;
1593
- GC_G (gc_protected ) = 0 ;
1594
1592
GC_G (gc_active ) = 0 ;
1595
1593
}
1596
1594
You can’t perform that action at this time.
0 commit comments