Skip to content

Commit 77eb754

Browse files
committed
Mark enums and static fake closures as not collectable
1 parent c893591 commit 77eb754

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Zend/zend_closures.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,9 @@ ZEND_API void zend_create_fake_closure(zval *res, zend_function *func, zend_clas
866866

867867
closure = (zend_closure *)Z_OBJ_P(res);
868868
closure->func.common.fn_flags |= ZEND_ACC_FAKE_CLOSURE;
869+
if (Z_TYPE(closure->this_ptr) == IS_NULL) {
870+
GC_ADD_FLAGS(&closure->std, GC_NOT_COLLECTABLE);
871+
}
869872
}
870873
/* }}} */
871874

Zend/zend_enum.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ ZEND_API zend_object_handlers zend_enum_object_handlers;
3939
zend_object *zend_enum_new(zval *result, zend_class_entry *ce, zend_string *case_name, zval *backing_value_zv)
4040
{
4141
zend_object *zobj = zend_objects_new(ce);
42+
GC_ADD_FLAGS(zobj, GC_NOT_COLLECTABLE);
4243
ZVAL_OBJ(result, zobj);
4344

4445
zval *zname = OBJ_PROP_NUM(zobj, 0);

0 commit comments

Comments
 (0)