php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #54423
Patch dlunload_destroy_classes.diff revision 2011-03-30 12:55 UTC by tony at daylessday dot org

Patch dlunload_destroy_classes.diff for Scripting Engine problem Bug #54423

Patch version 2011-03-30 12:55 UTC

Return to Bug #54423 | Download this patch
Patch Revisions:

Developer: tony@daylessday.org

Index: Zend/zend_API.c
===================================================================
--- Zend/zend_API.c	(revision 308156)
+++ Zend/zend_API.c	(working copy)
@@ -2082,6 +2082,22 @@
 }
 /* }}} */
 
+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 @@
 	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) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC