Skip to content

Commit b9cebe9

Browse files
committed
properly releases memory for dynamic property type
1 parent 02ee5f7 commit b9cebe9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ext/zend_test/test.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ static void release_internal_zend_type(zend_type *type) {
982982
} else if (ZEND_TYPE_HAS_NAME(*type)) {
983983
zend_string_release(ZEND_TYPE_NAME(*type));
984984
}
985-
// zero-out the type to avoid double-free on shutdown in zend_free_internal_arg_info
985+
// zero-out the type to avoid double-free on shutdown
986986
memset(type, 0, sizeof(zend_type));
987987
}
988988

@@ -1003,6 +1003,12 @@ static void release_dynamic_function_entries(void) {
10031003
}
10041004
}
10051005

1006+
// workaround for https://github.com/php/php-src/issues/11883
1007+
static void release_ZendTestClass_dnf_property(void) {
1008+
zend_property_info *prop = zend_hash_str_find_ptr(&zend_test_class->properties_info, "dnfProperty", sizeof("dnfProperty") - 1);
1009+
release_internal_zend_type(&prop->type);
1010+
}
1011+
10061012
PHP_MINIT_FUNCTION(zend_test)
10071013
{
10081014
register_dynamic_function_entries();
@@ -1080,6 +1086,7 @@ PHP_MINIT_FUNCTION(zend_test)
10801086
PHP_MSHUTDOWN_FUNCTION(zend_test)
10811087
{
10821088
release_dynamic_function_entries();
1089+
release_ZendTestClass_dnf_property();
10831090

10841091
if (type != MODULE_TEMPORARY) {
10851092
UNREGISTER_INI_ENTRIES();

0 commit comments

Comments
 (0)