Skip to content

Commit

Permalink
Remove old apache_hooks occurrence
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petk authored and nikic committed Oct 8, 2017
1 parent 3644cc6 commit 4fcecfb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 142 deletions.
140 changes: 0 additions & 140 deletions main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions main/php_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4fcecfb

Please sign in to comment.