com php-src: Fix bug #79900: Zend/tests/bug79900.phpt Zend/zend_execute_API.c
| From: | Nikita Popov | Date: | Wed, 29 Jul 2020 13:27:48 +0000 |
| Subject: | com php-src: Fix bug #79900: Zend/tests/bug79900.phpt Zend/zend_execute_API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112437@lists.php.net to get a copy of this message | ||
Commit: c206c742d6225c7f4c7ffbf95e33034d8de59047
Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 29 Jul 2020 15:25:57 +0200
Parents: e2f39f84e2366bb9aee16fe248aad893c0aa6380
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c206c742d6225c7f4c7ffbf95e33034d8de59047
Log:
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.
Bugs:
https://bugs.php.net/79900
Changed paths:
A Zend/tests/bug79900.phpt
M Zend/zend_execute_API.c
Diff:
diff --git a/Zend/tests/bug79900.phpt b/Zend/tests/bug79900.phpt
new file mode 100644
index 0000000000..a09a72c74c
--- /dev/null
+++ b/Zend/tests/bug79900.phpt
@@ -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===
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 998eb495dc..e6f1e44fca 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -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