mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed static data cleanup
This commit is contained in:
parent
d735434e47
commit
ef6919e6f2
3 changed files with 30 additions and 22 deletions
|
@ -662,12 +662,12 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
|
|||
ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC);
|
||||
ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC);
|
||||
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_user_class_data(zend_class_entry **pce TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_class_data(zval *zv TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_user_class_data(zval *zv TSRMLS_DC);
|
||||
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC);
|
||||
ZEND_API void zend_cleanup_internal_classes(TSRMLS_D);
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data(zval *zv TSRMLS_DC);
|
||||
ZEND_API int zend_cleanup_function_data_full(zval *zv TSRMLS_DC);
|
||||
|
||||
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
|
||||
ZEND_API void zend_function_dtor(zval *zv);
|
||||
|
|
|
@ -282,11 +282,11 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
|
|||
* Note that only run-time accessed data need to be cleaned up, pre-defined data can
|
||||
* not contain objects and thus are not probelmatic */
|
||||
if (EG(full_tables_cleanup)) {
|
||||
zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data TSRMLS_CC);
|
||||
zend_hash_apply(EG(function_table), zend_cleanup_function_data_full TSRMLS_CC);
|
||||
zend_hash_apply(EG(class_table), zend_cleanup_class_data TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) zend_cleanup_user_class_data TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(function_table), zend_cleanup_function_data TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), zend_cleanup_user_class_data TSRMLS_CC);
|
||||
zend_cleanup_internal_classes(TSRMLS_C);
|
||||
}
|
||||
} zend_end_try();
|
||||
|
@ -298,11 +298,11 @@ void shutdown_executor(TSRMLS_D) /* {{{ */
|
|||
|
||||
/* Destroy all op arrays */
|
||||
if (EG(full_tables_cleanup)) {
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function_full TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), clean_non_persistent_class_full TSRMLS_CC);
|
||||
} else {
|
||||
zend_hash_reverse_apply(EG(function_table), (apply_func_t) clean_non_persistent_function TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), (apply_func_t) clean_non_persistent_class TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(function_table), clean_non_persistent_function TSRMLS_CC);
|
||||
zend_hash_reverse_apply(EG(class_table), clean_non_persistent_class TSRMLS_CC);
|
||||
}
|
||||
|
||||
while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
|
||||
|
|
|
@ -136,8 +136,10 @@ static void zend_cleanup_op_array_data(zend_op_array *op_array)
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
|
||||
ZEND_API int zend_cleanup_function_data(zval *zv TSRMLS_DC)
|
||||
{
|
||||
zend_function *function = Z_PTR_P(zv);
|
||||
|
||||
if (function->type == ZEND_USER_FUNCTION) {
|
||||
zend_cleanup_op_array_data((zend_op_array *) function);
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
|
@ -146,8 +148,10 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
|
|||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC)
|
||||
ZEND_API int zend_cleanup_function_data_full(zval *zv TSRMLS_DC)
|
||||
{
|
||||
zend_function *function = Z_PTR_P(zv);
|
||||
|
||||
if (function->type == ZEND_USER_FUNCTION) {
|
||||
zend_cleanup_op_array_data((zend_op_array *) function);
|
||||
}
|
||||
|
@ -160,7 +164,7 @@ static inline void cleanup_user_class_data(zend_class_entry *ce TSRMLS_DC)
|
|||
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
|
||||
not contain objects and thus are not probelmatic */
|
||||
if (ce->ce_flags & ZEND_HAS_STATIC_IN_METHODS) {
|
||||
zend_hash_apply(&ce->function_table, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
|
||||
zend_hash_apply(&ce->function_table, zend_cleanup_function_data_full TSRMLS_CC);
|
||||
}
|
||||
if (ce->static_members_table) {
|
||||
int i;
|
||||
|
@ -200,22 +204,26 @@ ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce TSRMLS_DC)
|
|||
cleanup_internal_class_data(ce TSRMLS_CC);
|
||||
}
|
||||
|
||||
ZEND_API int zend_cleanup_user_class_data(zend_class_entry **pce TSRMLS_DC)
|
||||
ZEND_API int zend_cleanup_user_class_data(zval *zv TSRMLS_DC)
|
||||
{
|
||||
if ((*pce)->type == ZEND_USER_CLASS) {
|
||||
cleanup_user_class_data(*pce TSRMLS_CC);
|
||||
zend_class_entry *ce = Z_PTR_P(zv);
|
||||
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
cleanup_user_class_data(ce TSRMLS_CC);
|
||||
return ZEND_HASH_APPLY_KEEP;
|
||||
} else {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
}
|
||||
|
||||
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
|
||||
ZEND_API int zend_cleanup_class_data(zval *zv TSRMLS_DC)
|
||||
{
|
||||
if ((*pce)->type == ZEND_USER_CLASS) {
|
||||
cleanup_user_class_data(*pce TSRMLS_CC);
|
||||
zend_class_entry *ce = Z_PTR_P(zv);
|
||||
|
||||
if (ce->type == ZEND_USER_CLASS) {
|
||||
cleanup_user_class_data(ce TSRMLS_CC);
|
||||
} else {
|
||||
cleanup_internal_class_data(*pce TSRMLS_CC);
|
||||
cleanup_internal_class_data(ce TSRMLS_CC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue