tony2001 Thu, 31 Mar 2011 11:59:34 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=309853
Log: fix bug #54423 (classes from dl()'ed extensions are not destroyed) Bug: http://bugs.php.net/54423 (Closed) classes from dl()'ed extensions are not destroyed Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/Zend/zend_API.c U php/php-src/trunk/Zend/zend_API.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2011-03-31 09:00:14 UTC (rev 309852) +++ php/php-src/branches/PHP_5_3/NEWS 2011-03-31 11:59:34 UTC (rev 309853) @@ -2,6 +2,8 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 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) Modified: php/php-src/branches/PHP_5_3/Zend/zend_API.c =================================================================== --- php/php-src/branches/PHP_5_3/Zend/zend_API.c 2011-03-31 09:00:14 UTC (rev 309852) +++ php/php-src/branches/PHP_5_3/Zend/zend_API.c 2011-03-31 11:59:34 UTC (rev 309853) @@ -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) { Modified: php/php-src/trunk/Zend/zend_API.c =================================================================== --- php/php-src/trunk/Zend/zend_API.c 2011-03-31 09:00:14 UTC (rev 309852) +++ php/php-src/trunk/Zend/zend_API.c 2011-03-31 11:59:34 UTC (rev 309853) @@ -2208,6 +2208,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(); @@ -2215,6 +2231,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 CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php