Skip to content

Commit 3b52307

Browse files
committed
Merge branch 'PHP-7.4'
2 parents a369430 + 73115ef commit 3b52307

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

Zend/tests/bug78589.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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===

Zend/zend_gc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,6 @@ ZEND_API int zend_gc_collect_cycles(void)
15391539

15401540
/* Destroy zvals */
15411541
GC_TRACE("Destroying zvals");
1542-
GC_G(gc_protected) = 1;
15431542
current = GC_IDX2PTR(GC_FIRST_ROOT);
15441543
last = GC_IDX2PTR(GC_G(first_unused));
15451544
while (current != last) {
@@ -1590,7 +1589,6 @@ ZEND_API int zend_gc_collect_cycles(void)
15901589

15911590
GC_TRACE("Collection finished");
15921591
GC_G(collected) += count;
1593-
GC_G(gc_protected) = 0;
15941592
GC_G(gc_active) = 0;
15951593
}
15961594

0 commit comments

Comments
 (0)