]> granicus.if.org Git - php/commitdiff
Fix bug #79900
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 29 Jul 2020 13:25:57 +0000 (15:25 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 29 Jul 2020 13:27:48 +0000 (15:27 +0200)
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.

Zend/tests/bug79900.phpt [new file with mode: 0644]
Zend/zend_execute_API.c

diff --git a/Zend/tests/bug79900.phpt b/Zend/tests/bug79900.phpt
new file mode 100644 (file)
index 0000000..a09a72c
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #79900: Memory leaks reported if GC disabled at runtime
+--FILE--
+<?php
+
+gc_disable();
+$obj = new stdClass;
+$obj->obj = $obj;
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
index 998eb495dc5116997f8d00c17a7820d7ffab6cfc..e6f1e44fca1ac183e97c89e6a29722ce4b1cfafb 100644 (file)
@@ -329,7 +329,7 @@ void shutdown_executor(void) /* {{{ */
                zend_stack_clean(&EG(user_exception_handlers), (void (*)(void *))ZVAL_PTR_DTOR, 1);
 
 #if ZEND_DEBUG
-               if (gc_enabled() && !CG(unclean_shutdown)) {
+               if (!CG(unclean_shutdown)) {
                        gc_collect_cycles();
                }
 #endif