diff options
| author | Antony Dovgal <tony2001@php.net> | 2011-03-31 11:59:34 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2011-03-31 11:59:34 +0000 |
| commit | dd5781bcdf0d5514210de90b10167be6e40157f1 (patch) | |
| tree | 25403b7fcbf40c8d0896096557b17c8f42819a38 /Zend/zend_API.c | |
| parent | ef777fc18e1d51140cb4428e4cfeab12626f6706 (diff) | |
| download | php-git-dd5781bcdf0d5514210de90b10167be6e40157f1.tar.gz | |
fix bug #54423 (classes from dl()'ed extensions are not destroyed)
Diffstat (limited to 'Zend/zend_API.c')
| -rw-r--r-- | Zend/zend_API.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index e79d951df2..261170c41e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2082,6 +2082,22 @@ ZEND_API int zend_get_module_started(const char *module_name) /* {{{ */ } /* }}} */ +static int clean_module_class(const zend_class_entry **ce, int *module_number TSRMLS_DC) /* {{{ */ +{ + if ((*ce)->type == ZEND_INTERNAL_CLASS && (*ce)->module->module_number == *module_number) { + return ZEND_HASH_APPLY_REMOVE; + } else { + return ZEND_HASH_APPLY_KEEP; + } +} +/* }}} */ + +static void clean_module_classes(int module_number TSRMLS_DC) /* {{{ */ +{ + zend_hash_apply_with_argument(EG(class_table), (apply_func_arg_t) clean_module_class, (void *) &module_number TSRMLS_CC); +} +/* }}} */ + void module_destructor(zend_module_entry *module) /* {{{ */ { TSRMLS_FETCH(); @@ -2089,6 +2105,7 @@ void module_destructor(zend_module_entry *module) /* {{{ */ if (module->type == MODULE_TEMPORARY) { zend_clean_module_rsrc_dtors(module->module_number TSRMLS_CC); clean_module_constants(module->module_number TSRMLS_CC); + clean_module_classes(module->module_number TSRMLS_CC); } if (module->module_started && module->module_shutdown_func) { |
