Skip to content

Commit c206c74

Browse files
committed
Fix bug #79900
Run debug build shutdown GC regardless even if GC has been disabled. Of course, this only does something meaningful if the GC has been disabled at runtime and root collection is still enabled. We cannot prevent leaks if GC is disabled completely.
1 parent e2f39f8 commit c206c74

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Zend/tests/bug79900.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #79900: Memory leaks reported if GC disabled at runtime
3+
--FILE--
4+
<?php
5+
6+
gc_disable();
7+
$obj = new stdClass;
8+
$obj->obj = $obj;
9+
10+
?>
11+
===DONE===
12+
--EXPECT--
13+
===DONE===

Zend/zend_execute_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ void shutdown_executor(void) /* {{{ */
329329
zend_stack_clean(&EG(user_exception_handlers), (void (*)(void *))ZVAL_PTR_DTOR, 1);
330330

331331
#if ZEND_DEBUG
332-
if (gc_enabled() && !CG(unclean_shutdown)) {
332+
if (!CG(unclean_shutdown)) {
333333
gc_collect_cycles();
334334
}
335335
#endif

0 commit comments

Comments
 (0)