@@ -734,19 +734,6 @@ static zend_string* ZEND_FASTCALL accel_replace_string_by_shm_permanent(zend_str
734734 return str ;
735735}
736736
737- static zend_string * ZEND_FASTCALL accel_replace_string_by_process_permanent (zend_string * str )
738- {
739- zend_string * ret = zend_interned_string_find_permanent (str );
740-
741- if (ret ) {
742- zend_string_release (str );
743- return ret ;
744- }
745- ZEND_ASSERT (0 );
746- return str ;
747- }
748-
749-
750737static void accel_use_shm_interned_strings (void )
751738{
752739 HANDLE_BLOCK_INTERRUPTIONS ();
@@ -768,15 +755,6 @@ static void accel_use_shm_interned_strings(void)
768755 HANDLE_UNBLOCK_INTERRUPTIONS ();
769756}
770757
771- static void accel_use_permanent_interned_strings (void )
772- {
773- if (ZCSG (preload_script )) {
774- preload_shutdown ();
775- }
776-
777- accel_copy_permanent_strings (accel_replace_string_by_process_permanent );
778- }
779-
780758#ifndef ZEND_WIN32
781759static inline void kill_all_lockers (struct flock * mem_usage_check )
782760{
@@ -2578,8 +2556,6 @@ static int zend_accel_init_shm(void)
25782556 STRTAB_INVALID_POS ,
25792557 (char * )ZCSG (interned_strings ).start -
25802558 ((char * )& ZCSG (interned_strings ) + sizeof (zend_string_table )));
2581-
2582- zend_interned_strings_set_permanent_storage_copy_handlers (accel_use_shm_interned_strings , accel_use_permanent_interned_strings );
25832559 }
25842560
25852561 zend_interned_strings_set_request_storage_handlers (accel_new_interned_string_for_php , accel_init_interned_string_for_php );
@@ -2802,6 +2778,9 @@ static int accel_startup(zend_extension *extension)
28022778 orig_post_startup_cb = zend_post_startup_cb ;
28032779 zend_post_startup_cb = accel_post_startup ;
28042780
2781+ /* Prevent unloadig */
2782+ extension -> handle = 0 ;
2783+
28052784 return SUCCESS ;
28062785}
28072786
@@ -2842,9 +2821,6 @@ static int accel_post_startup(void)
28422821 case SUCCESSFULLY_REATTACHED :
28432822 zend_shared_alloc_lock ();
28442823 accel_shared_globals = (zend_accel_shared_globals * ) ZSMMG (app_shared_globals );
2845- if (ZCG (accel_directives ).interned_strings_buffer ) {
2846- zend_interned_strings_set_permanent_storage_copy_handlers (accel_use_shm_interned_strings , accel_use_permanent_interned_strings );
2847- }
28482824 zend_interned_strings_set_request_storage_handlers (accel_new_interned_string_for_php , accel_init_interned_string_for_php );
28492825 zend_shared_alloc_unlock ();
28502826 break ;
@@ -2940,9 +2916,20 @@ static int accel_post_startup(void)
29402916
29412917 zend_optimizer_startup ();
29422918
2919+ if (!file_cache_only && ZCG (accel_directives ).interned_strings_buffer ) {
2920+ accel_use_shm_interned_strings ();
2921+ }
2922+
29432923 return accel_finish_startup ();
29442924}
29452925
2926+ static void (* orig_post_shutdown_cb )(void );
2927+
2928+ static void accel_post_shutdown (void )
2929+ {
2930+ zend_shared_alloc_shutdown ();
2931+ }
2932+
29462933void accel_shutdown (void )
29472934{
29482935 zend_ini_entry * ini_entry ;
@@ -2959,6 +2946,10 @@ void accel_shutdown(void)
29592946 return ;
29602947 }
29612948
2949+ if (ZCSG (preload_script )) {
2950+ preload_shutdown ();
2951+ }
2952+
29622953#ifdef HAVE_OPCACHE_FILE_CACHE
29632954 _file_cache_only = file_cache_only ;
29642955#endif
@@ -2970,8 +2961,11 @@ void accel_shutdown(void)
29702961#endif
29712962
29722963 if (!_file_cache_only ) {
2973- zend_shared_alloc_shutdown ();
2964+ /* Delay SHM dettach */
2965+ orig_post_shutdown_cb = zend_post_shutdown_cb ;
2966+ zend_post_shutdown_cb = accel_post_shutdown ;
29742967 }
2968+
29752969 zend_compile_file = accelerator_orig_compile_file ;
29762970
29772971 if ((ini_entry = zend_hash_str_find_ptr (EG (ini_directives ), "include_path" , sizeof ("include_path" )- 1 )) != NULL ) {
@@ -3876,9 +3870,6 @@ static int accel_finish_startup(void)
38763870 sapi_module .getenv = NULL ;
38773871
38783872 zend_interned_strings_switch_storage (1 );
3879- if (ZCG (accel_directives ).interned_strings_buffer ) {
3880- zend_interned_strings_set_permanent_storage_copy_handlers (NULL , accel_use_permanent_interned_strings );
3881- }
38823873
38833874 SIGG (reset ) = 0 ;
38843875 if (php_request_startup () == SUCCESS ) {
0 commit comments