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 @@ -1549,7 +1549,6 @@ ZEND_API int zend_gc_collect_cycles(void)
1549
1549
1550
1550
/* Destroy zvals */
1551
1551
GC_TRACE ("Destroying zvals" );
1552
- GC_G (gc_protected ) = 1 ;
1553
1552
current = GC_IDX2PTR (GC_FIRST_ROOT );
1554
1553
last = GC_IDX2PTR (GC_G (first_unused ));
1555
1554
while (current != last ) {
@@ -1600,7 +1599,6 @@ ZEND_API int zend_gc_collect_cycles(void)
1600
1599
1601
1600
GC_TRACE ("Collection finished" );
1602
1601
GC_G (collected ) += count ;
1603
- GC_G (gc_protected ) = 0 ;
1604
1602
GC_G (gc_active ) = 0 ;
1605
1603
}
1606
1604
You can’t perform that action at this time.
0 commit comments