1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 04:02:19 +02:00

Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov
2019-09-24 12:19:14 +02:00
2 changed files with 19 additions and 2 deletions

19
Zend/tests/bug78589.phpt Normal file
View File

@@ -0,0 +1,19 @@
--TEST--
Bug #78589: Memory leak with GC + __destruct()
--FILE--
<?php
class Test {
public function __destruct() {}
}
$test = new Test;
$test->foo = [&$test->foo];
$ary = [&$ary, $test];
unset($ary, $test);
gc_collect_cycles();
?>
===DONE===
--EXPECT--
===DONE===

View File

@@ -1539,7 +1539,6 @@ ZEND_API int zend_gc_collect_cycles(void)
/* Destroy zvals */
GC_TRACE("Destroying zvals");
GC_G(gc_protected) = 1;
current = GC_IDX2PTR(GC_FIRST_ROOT);
last = GC_IDX2PTR(GC_G(first_unused));
while (current != last) {
@@ -1590,7 +1589,6 @@ ZEND_API int zend_gc_collect_cycles(void)
GC_TRACE("Collection finished");
GC_G(collected) += count;
GC_G(gc_protected) = 0;
GC_G(gc_active) = 0;
}