@@ -107,23 +107,27 @@ static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC)
107
107
}
108
108
109
109
110
- static int is_not_internal_function (zend_function * function TSRMLS_DC )
110
+ static int clean_non_persistent_function (zend_function * function TSRMLS_DC )
111
111
{
112
- if (function -> type == ZEND_INTERNAL_FUNCTION ) {
113
- return EG (full_tables_cleanup ) ? 0 : ZEND_HASH_APPLY_STOP ;
114
- } else {
115
- return EG (full_tables_cleanup ) ? 1 : ZEND_HASH_APPLY_REMOVE ;
116
- }
112
+ return (function -> type == ZEND_INTERNAL_FUNCTION ) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE ;
117
113
}
118
114
119
115
120
- static int is_not_internal_class ( zend_class_entry * * ce TSRMLS_DC )
116
+ static int clean_non_persistent_function_full ( zend_function * function TSRMLS_DC )
121
117
{
122
- if ((* ce )-> type == ZEND_INTERNAL_CLASS ) {
123
- return EG (full_tables_cleanup ) ? 0 : ZEND_HASH_APPLY_STOP ;
124
- } else {
125
- return EG (full_tables_cleanup ) ? 1 : ZEND_HASH_APPLY_REMOVE ;
126
- }
118
+ return (function -> type == ZEND_INTERNAL_FUNCTION ) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE ;
119
+ }
120
+
121
+
122
+ static int clean_non_persistent_class (zend_class_entry * * ce TSRMLS_DC )
123
+ {
124
+ return ((* ce )-> type == ZEND_INTERNAL_CLASS ) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE ;
125
+ }
126
+
127
+
128
+ static int clean_non_persistent_class_full (zend_class_entry * * ce TSRMLS_DC )
129
+ {
130
+ return ((* ce )-> type == ZEND_INTERNAL_CLASS ) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE ;
127
131
}
128
132
129
133
@@ -263,18 +267,22 @@ void shutdown_executor(TSRMLS_D)
263
267
So we want first of all to clean up all data and then move to tables destruction.
264
268
Note that only run-time accessed data need to be cleaned up, pre-defined data can
265
269
not contain objects and thus are not probelmatic */
266
- zend_hash_apply (EG (function_table ), (apply_func_t ) zend_cleanup_function_data TSRMLS_CC );
270
+ if (EG (full_tables_cleanup )) {
271
+ zend_hash_apply (EG (function_table ), (apply_func_t ) zend_cleanup_function_data_full TSRMLS_CC );
272
+ } else {
273
+ zend_hash_reverse_apply (EG (function_table ), (apply_func_t ) zend_cleanup_function_data TSRMLS_CC );
274
+ }
267
275
zend_hash_apply (EG (class_table ), (apply_func_t ) zend_cleanup_class_data TSRMLS_CC );
268
276
269
277
zend_ptr_stack_destroy (& EG (argument_stack ));
270
278
271
279
/* Destroy all op arrays */
272
280
if (EG (full_tables_cleanup )) {
273
- zend_hash_apply (EG (function_table ), (apply_func_t ) is_not_internal_function TSRMLS_CC );
274
- zend_hash_apply (EG (class_table ), (apply_func_t ) is_not_internal_class TSRMLS_CC );
281
+ zend_hash_apply (EG (function_table ), (apply_func_t ) clean_non_persistent_function_full TSRMLS_CC );
282
+ zend_hash_apply (EG (class_table ), (apply_func_t ) clean_non_persistent_class_full TSRMLS_CC );
275
283
} else {
276
- zend_hash_reverse_apply (EG (function_table ), (apply_func_t ) is_not_internal_function TSRMLS_CC );
277
- zend_hash_reverse_apply (EG (class_table ), (apply_func_t ) is_not_internal_class TSRMLS_CC );
284
+ zend_hash_reverse_apply (EG (function_table ), (apply_func_t ) clean_non_persistent_function TSRMLS_CC );
285
+ zend_hash_reverse_apply (EG (class_table ), (apply_func_t ) clean_non_persistent_class TSRMLS_CC );
278
286
}
279
287
280
288
while (EG (symtable_cache_ptr )>=EG (symtable_cache )) {
0 commit comments