Skip to content

Commit 92284c7

Browse files
committed
fixup! properly releases memory for dynamic property type
1 parent 9748f30 commit 92284c7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ext/zend_test/test.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,9 +1004,12 @@ static void release_dynamic_function_entries(void) {
10041004
}
10051005

10061006
// 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);
1007+
static void release_ZendTestClass_dnf_property(int module_type) {
1008+
// zend_hash_str_find_bucket fails when the module is loaded with dl(), no idea why...
1009+
if (module_type == MODULE_PERSISTENT) {
1010+
zend_property_info *prop = zend_hash_str_find_ptr(&zend_test_class->properties_info, "dnfProperty", sizeof("dnfProperty") - 1);
1011+
release_internal_zend_type(&prop->type);
1012+
}
10101013
}
10111014

10121015
PHP_MINIT_FUNCTION(zend_test)
@@ -1086,7 +1089,7 @@ PHP_MINIT_FUNCTION(zend_test)
10861089
PHP_MSHUTDOWN_FUNCTION(zend_test)
10871090
{
10881091
release_dynamic_function_entries();
1089-
release_ZendTestClass_dnf_property();
1092+
release_ZendTestClass_dnf_property(type);
10901093

10911094
if (type != MODULE_TEMPORARY) {
10921095
UNREGISTER_INI_ENTRIES();

0 commit comments

Comments
 (0)