From: Zeev Suraski Date: Tue, 23 Oct 2001 01:23:36 +0000 (+0000) Subject: MFZE1 X-Git-Tag: POST_PARAMETER_PARSING_API~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aecd5b89ee4e766be4dfb1cf07369a8bc39efd83;p=php MFZE1 --- diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index b4deb62f82..8fb2b8c3db 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -58,9 +58,9 @@ void zend_copy_constants(HashTable *target, HashTable *source) static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC) { if (c->flags & CONST_PERSISTENT) { - return ZEND_HASH_APPLY_STOP; + return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP; } else { - return ZEND_HASH_APPLY_REMOVE; + return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE; } } @@ -160,7 +160,11 @@ int zend_shutdown_constants(TSRMLS_D) void clean_non_persistent_constants(TSRMLS_D) { - zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC); + if (EG(full_tables_cleanup)) { + zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC); + } else { + zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC); + } } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 2c541d9227..55fd232993 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -93,9 +93,9 @@ static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC) static int is_not_internal_function(zend_function *function TSRMLS_DC) { if (function->type == ZEND_INTERNAL_FUNCTION) { - return ZEND_HASH_APPLY_STOP; + return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP; } else { - return ZEND_HASH_APPLY_REMOVE; + return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE; } } @@ -103,9 +103,9 @@ static int is_not_internal_function(zend_function *function TSRMLS_DC) static int is_not_internal_class(zend_class_entry *ce TSRMLS_DC) { if (ce->type == ZEND_INTERNAL_CLASS) { - return ZEND_HASH_APPLY_STOP; + return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP; } else { - return ZEND_HASH_APPLY_REMOVE; + return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE; } } @@ -183,8 +183,13 @@ void shutdown_executor(TSRMLS_D) zend_ptr_stack_destroy(&EG(argument_stack)); /* Destroy all op arrays */ - 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); + if (EG(full_tables_cleanup) { + zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC); + zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC); + } else { + 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); + } } zend_end_try(); /* The regular list must be destroyed after the main symbol table and @@ -666,6 +671,7 @@ ZEND_API void zend_timeout(int dummy) } + EG(full_tables_cleanup) = 0; #ifdef ZEND_WIN32 static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 31ad79bd65..67d15c3146 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -166,6 +166,7 @@ struct _zend_executor_globals { zend_bool in_execution; zend_bool bailout_set; + zend_bool full_tables_cleanup; /* for extended information support */ zend_bool no_extensions;