]> granicus.if.org Git - php/commitdiff
Fix leak with cycle in static prop of internal class
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 21 Oct 2019 08:26:10 +0000 (10:26 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 21 Oct 2019 08:26:10 +0000 (10:26 +0200)
More the cleanup of interned classes before the final GC run,
just like it is done for user classes.

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

diff --git a/Zend/tests/bug78335_2.phpt b/Zend/tests/bug78335_2.phpt
new file mode 100644 (file)
index 0000000..bc9e8f5
--- /dev/null
@@ -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===
index c2ab453485224dd582a1eaba5b15c9d59d611083..d9e0d0a8aad61ee385e892b70f485fab97d8474f 100644 (file)
@@ -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));