summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2003-01-29 17:54:48 +0000
committerStanislav Malyshev <stas@php.net>2003-01-29 17:54:48 +0000
commit03f88ac2b22db9f0a9673ed702da0e28dea536bc (patch)
treef7e258c06989ae18c83e11caa0fd13d920365bf7 /Zend/zend_execute_API.c
parent6b203c70a3e0a4e75e81ebbc062d3f8fce4f08bd (diff)
downloadphp-git-03f88ac2b22db9f0a9673ed702da0e28dea536bc.tar.gz
Add additional stage to post-session cleanup.
We need separate cleanup stage because of the following problem: Suppose we destroy class X, which destroys function table, and in function table we have function foo() that has static $bar. Now if object of class X was assigned to $bar, its destructor will be called and will fail since X's function table is in mid-destruction. So we want first of all to clean up all data and then move to tables destruction. Note that only run-time accessed data need to be cleaned up, pre-defined data can not contain objects and thus are not probelmatic. # Looks like we are having a lots of pain in the various parts of the body # because of the destructors...
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index c842ccc07f..6da53cacd0 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -218,6 +218,17 @@ void shutdown_executor(TSRMLS_D)
zend_ptr_stack_destroy(&EG(argument_stack));
+ /* Cleanup static data for functions and arrays.
+ We need separate cleanup stage because of the following problem:
+ Suppose we destroy class X, which destroys function table,
+ and in function table we have function foo() that has static $bar. Now if
+ object of class X is assigned to $bar, its destructor will be called and will
+ fail since X's function table is in mid-destruction.
+ So we want first of all to clean up all data and then move to tables destruction.
+ Note that only run-time accessed data need to be cleaned up, pre-defined data can
+ not contain objects and thus are not probelmatic */
+ zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data);
+ zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data);
/* Destroy all op arrays */
if (EG(full_tables_cleanup)) {
zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);