com php-src: Fix leak with cycle in static prop of internal class: Zend/tests/bug78335_2.phpt Zend/zend_execut e_API.c
| From: | Nikita Popov | Date: | Mon, 21 Oct 2019 08:26:10 +0000 |
| Subject: | com php-src: Fix leak with cycle in static prop of internal class: Zend/tests/bug78335_2.phpt Zend/zend_execut e_API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108967@lists.php.net to get a copy of this message | ||
Commit: ed31e0413309286473c9f5a32614a9c6b4062d3e
Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 21 Oct 2019 10:26:10 +0200
Parents: 1ac961bea85930d9c71bcca349ee4b9d84edd3b8
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ed31e0413309286473c9f5a32614a9c6b4062d3e
Log:
Fix leak with cycle in static prop of internal class
More the cleanup of interned classes before the final GC run,
just like it is done for user classes.
Changed paths:
A Zend/tests/bug78335_2.phpt
M Zend/zend_execute_API.c
Diff:
diff --git a/Zend/tests/bug78335_2.phpt b/Zend/tests/bug78335_2.phpt
new file mode 100644
index 00000000000..bc9e8f5f0ca
--- /dev/null
+++ b/Zend/tests/bug78335_2.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #78335: Static properties containing cycles report as leak (internal class variant)
+--FILE--
+<?php
+
+$foo = [&$foo];
+_ZendTestClass::$_StaticProp = $foo;
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index c2ab4534852..d9e0d0a8aad 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -294,9 +294,6 @@ void shutdown_executor(void) /* {{{ */
} ZEND_HASH_FOREACH_END();
ZEND_HASH_REVERSE_FOREACH_VAL(EG(class_table), zv) {
zend_class_entry *ce = Z_PTR_P(zv);
- if (ce->type == ZEND_INTERNAL_CLASS) {
- break;
- }
if (ce->default_static_members_count) {
zend_cleanup_internal_class_data(ce);
}
@@ -397,8 +394,6 @@ void shutdown_executor(void) /* {{{ */
} ZEND_HASH_FOREACH_END_DEL();
}
- zend_cleanup_internal_classes();
-
while (EG(symtable_cache_ptr) > EG(symtable_cache)) {
EG(symtable_cache_ptr)--;
zend_hash_destroy(*EG(symtable_cache_ptr));