Skip to content

Commit ed31e04

Browse files
committed
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.
1 parent 1ac961b commit ed31e04

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Zend/tests/bug78335_2.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Bug #78335: Static properties containing cycles report as leak (internal class variant)
3+
--FILE--
4+
<?php
5+
6+
$foo = [&$foo];
7+
_ZendTestClass::$_StaticProp = $foo;
8+
9+
?>
10+
===DONE===
11+
--EXPECT--
12+
===DONE===

Zend/zend_execute_API.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,6 @@ void shutdown_executor(void) /* {{{ */
294294
} ZEND_HASH_FOREACH_END();
295295
ZEND_HASH_REVERSE_FOREACH_VAL(EG(class_table), zv) {
296296
zend_class_entry *ce = Z_PTR_P(zv);
297-
if (ce->type == ZEND_INTERNAL_CLASS) {
298-
break;
299-
}
300297
if (ce->default_static_members_count) {
301298
zend_cleanup_internal_class_data(ce);
302299
}
@@ -397,8 +394,6 @@ void shutdown_executor(void) /* {{{ */
397394
} ZEND_HASH_FOREACH_END_DEL();
398395
}
399396

400-
zend_cleanup_internal_classes();
401-
402397
while (EG(symtable_cache_ptr) > EG(symtable_cache)) {
403398
EG(symtable_cache_ptr)--;
404399
zend_hash_destroy(*EG(symtable_cache_ptr));

0 commit comments

Comments
 (0)