Permalink
Browse files

fix bug #54423 (classes from dl()'ed extensions are not destroyed)

  • Loading branch information...
tony2001 committed Mar 31, 2011
1 parent ef777fc commit dd5781bcdf0d5514210de90b10167be6e40157f1
Showing with 19 additions and 0 deletions.
  1. +2 −0 NEWS
  2. +17 −0 Zend/zend_API.c
View
2 NEWS
@@ -2,6 +2,8 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2011, PHP 5.3.7
- Zend Engine:
+ . Fixed bug #54423 (classes from dl()'ed extensions are not destroyed).
+ (Tony, Dmitry)
. Fixed bug #54262 (Crash when assigning value to a dimension in a non-array).
(Dmitry)
View
@@ -2082,13 +2082,30 @@ 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();
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) {

0 comments on commit dd5781b

Please sign in to comment.