From 4fcecfb291387593cfebfc4ea085ebb6742792cd Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 5 Oct 2017 19:07:28 +0200 Subject: [PATCH] Remove old apache_hooks occurrence The apache_hooks SAPI has been removed since PHP >= 7.0 and there is no need to have two different php_request_startup definitions. Also php_request_startup_for_hook() and php_request_shutdown_for_hook() functions are not used in the PHP source code directly anymore. They are out of sync and are not touched when making changes to the shutdown sequence. The php_start_sapi() function was therefore not used anymore and is removed. --- main/main.c | 140 ------------------------------------------------ main/php_main.h | 2 - 2 files changed, 142 deletions(-) diff --git a/main/main.c b/main/main.c index e4c97f686d..dfa3378913 100644 --- a/main/main.c +++ b/main/main.c @@ -1590,39 +1590,8 @@ static void sigchld_handler(int apar) /* }}} */ #endif -/* {{{ php_start_sapi() - */ -static int php_start_sapi(void) -{ - int retval = SUCCESS; - - if(!SG(sapi_started)) { - zend_try { - PG(during_request_startup) = 1; - - /* initialize global variables */ - PG(modules_activated) = 0; - PG(header_is_being_sent) = 0; - PG(connection_status) = PHP_CONNECTION_NORMAL; - - zend_activate(); - zend_set_timeout(EG(timeout_seconds), 1); - zend_activate_modules(); - PG(modules_activated)=1; - } zend_catch { - retval = FAILURE; - } zend_end_try(); - - SG(sapi_started) = 1; - } - return retval; -} - -/* }}} */ - /* {{{ php_request_startup */ -#ifndef APACHE_HOOKS int php_request_startup(void) { int retval = SUCCESS; @@ -1702,61 +1671,6 @@ int php_request_startup(void) return retval; } -# else -int php_request_startup(void) -{ - int retval = SUCCESS; - - zend_interned_strings_activate(); - -#if PHP_SIGCHILD - signal(SIGCHLD, sigchld_handler); -#endif - - if (php_start_sapi() == FAILURE) { - return FAILURE; - } - - php_output_activate(); - sapi_activate(); - php_hash_environment(); - - zend_try { - PG(during_request_startup) = 1; - if (PG(expose_php)) { - sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1); - } - } zend_catch { - retval = FAILURE; - } zend_end_try(); - - return retval; -} -# endif -/* }}} */ - -/* {{{ php_request_startup_for_hook - */ -int php_request_startup_for_hook(void) -{ - int retval = SUCCESS; - - zend_interned_strings_activate(); - -#if PHP_SIGCHLD - signal(SIGCHLD, sigchld_handler); -#endif - - if (php_start_sapi() == FAILURE) { - return FAILURE; - } - - php_output_activate(); - sapi_activate_headers_only(); - php_hash_environment(); - - return retval; -} /* }}} */ /* {{{ php_request_shutdown_for_exec @@ -1771,60 +1685,6 @@ void php_request_shutdown_for_exec(void *dummy) } /* }}} */ -/* {{{ php_request_shutdown_for_hook - */ -void php_request_shutdown_for_hook(void *dummy) -{ - - if (PG(modules_activated)) zend_try { - php_call_shutdown_functions(); - } zend_end_try(); - - if (PG(modules_activated)) { - zend_deactivate_modules(); - } - - if (PG(modules_activated)) { - php_free_shutdown_functions(); - } - - zend_try { - zend_unset_timeout(); - } zend_end_try(); - - zend_try { - int i; - - for (i = 0; i < NUM_TRACK_VARS; i++) { - zval_ptr_dtor(&PG(http_globals)[i]); - } - } zend_end_try(); - - zend_deactivate(); - - zend_try { - sapi_deactivate(); - } zend_end_try(); - - zend_try { - php_shutdown_stream_hashes(); - } zend_end_try(); - - zend_interned_strings_deactivate(); - - zend_try { - shutdown_memory_manager(CG(unclean_shutdown), 0); - } zend_end_try(); - -#ifdef ZEND_SIGNALS - zend_try { - zend_signal_deactivate(); - } zend_end_try(); -#endif -} - -/* }}} */ - /* {{{ php_request_shutdown */ void php_request_shutdown(void *dummy) diff --git a/main/php_main.h b/main/php_main.h index ff342a1f38..539f9e7456 100644 --- a/main/php_main.h +++ b/main/php_main.h @@ -34,8 +34,6 @@ PHPAPI int php_module_startup(sapi_module_struct *sf, zend_module_entry *additio PHPAPI void php_module_shutdown(void); PHPAPI void php_module_shutdown_for_exec(void); PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals); -PHPAPI int php_request_startup_for_hook(void); -PHPAPI void php_request_shutdown_for_hook(void *dummy); PHPAPI int php_register_extensions(zend_module_entry **ptr, int count); -- 2.50.1