38
38
# define GLOBAL_FUNCTION_TABLE CG(function_table)
39
39
# define GLOBAL_CLASS_TABLE CG(class_table)
40
40
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
41
+ # define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
41
42
#endif
42
43
43
44
#if defined(ZEND_WIN32 ) && ZEND_DEBUG
@@ -88,6 +89,7 @@ HashTable *global_function_table;
88
89
HashTable * global_class_table ;
89
90
HashTable * global_constants_table ;
90
91
HashTable * global_auto_globals_table ;
92
+ static HashTable * global_persistent_list = NULL ;
91
93
#endif
92
94
93
95
ZEND_API zend_utility_values zend_uv ;
@@ -486,6 +488,13 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
486
488
static void executor_globals_dtor (zend_executor_globals * executor_globals TSRMLS_DC )
487
489
{
488
490
zend_ini_shutdown (TSRMLS_C );
491
+ if (& executor_globals -> persistent_list != global_persistent_list ) {
492
+ zend_destroy_rsrc_list (& executor_globals -> persistent_list TSRMLS_CC );
493
+ }
494
+ if (executor_globals -> zend_constants != GLOBAL_CONSTANTS_TABLE ) {
495
+ zend_hash_destroy (executor_globals -> zend_constants );
496
+ free (executor_globals -> zend_constants );
497
+ }
489
498
}
490
499
491
500
@@ -682,6 +691,7 @@ void zend_post_startup(TSRMLS_D)
682
691
compiler_globals_ctor (compiler_globals , tsrm_ls );
683
692
free (EG (zend_constants ));
684
693
executor_globals_ctor (executor_globals , tsrm_ls );
694
+ global_persistent_list = & EG (persistent_list );
685
695
zend_new_thread_end_handler (tsrm_thread_id () TSRMLS_CC );
686
696
}
687
697
#endif
@@ -691,9 +701,6 @@ void zend_shutdown(TSRMLS_D)
691
701
{
692
702
#ifdef ZEND_WIN32
693
703
zend_shutdown_timeout_thread ();
694
- #endif
695
- #ifndef ZTS
696
- zend_destroy_rsrc_list (& EG (persistent_list ) TSRMLS_CC );
697
704
#endif
698
705
zend_hash_graceful_reverse_destroy (& module_registry );
699
706
@@ -706,16 +713,18 @@ void zend_shutdown(TSRMLS_D)
706
713
zend_shutdown_extensions (TSRMLS_C );
707
714
free (zend_version_info );
708
715
709
- zend_shutdown_constants (TSRMLS_C );
710
716
free (GLOBAL_FUNCTION_TABLE );
711
717
free (GLOBAL_CLASS_TABLE );
712
- #ifdef ZTS
713
- zend_destroy_rsrc_list (& EG (persistent_list ) TSRMLS_CC );
718
+
714
719
zend_hash_destroy (GLOBAL_CONSTANTS_TABLE );
715
720
free (GLOBAL_CONSTANTS_TABLE );
721
+
722
+ zend_destroy_rsrc_list (& EG (persistent_list ) TSRMLS_CC );
723
+ #ifdef ZTS
716
724
GLOBAL_FUNCTION_TABLE = NULL ;
717
725
GLOBAL_CLASS_TABLE = NULL ;
718
726
GLOBAL_AUTO_GLOBALS_TABLE = NULL ;
727
+ GLOBAL_CONSTANTS_TABLE = NULL ;
719
728
#endif
720
729
zend_destroy_rsrc_list_dtors ();
721
730
}
0 commit comments