From: Stanislav Malyshev Date: Wed, 29 Jan 2003 14:33:18 +0000 (+0000) Subject: Fix object destructors: X-Git-Tag: RELEASE_0_5~1375 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f73def91ed90dd422124a54ac7e05b670c0f43f0;p=php Fix object destructors: zend_objects_store_call_destructors is not used anymore, we rely on symbol tables cleaners to destroy all objects. --- diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index e5641f91e2..c842ccc07f 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -189,15 +189,23 @@ void init_executor(TSRMLS_D) void shutdown_executor(TSRMLS_D) { zend_try { - zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC); - zend_ptr_stack_destroy(&EG(arg_types_stack)); - - while (EG(symtable_cache_ptr)>=EG(symtable_cache)) { + +/* Removed because this can not be safely done, e.g. in this situation: + Object 1 creates object 2 + Object 3 holds reference to object 2. + Now when 1 and 2 are destroyed, 3 can still access 2 in its destructor, with + very problematic results */ +/* zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC); */ + +/* Moved after symbol table cleaners, because some of the cleaners can call + destructors, which would use EG(symtable_cache_ptr) and thus leave leaks */ +/* while (EG(symtable_cache_ptr)>=EG(symtable_cache)) { zend_hash_destroy(*EG(symtable_cache_ptr)); efree(*EG(symtable_cache_ptr)); EG(symtable_cache_ptr)--; } +*/ zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC); zend_hash_destroy(&EG(symbol_table)); @@ -218,6 +226,12 @@ void shutdown_executor(TSRMLS_D) zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC); zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC); } + + while (EG(symtable_cache_ptr)>=EG(symtable_cache)) { + zend_hash_destroy(*EG(symtable_cache_ptr)); + efree(*EG(symtable_cache_ptr)); + EG(symtable_cache_ptr)--; + } } zend_end_try(); zend_try {