cvs: php4(apache_hooks) /main main.c

From: Date: Mon, 26 Aug 2002 23:14:21 +0000
Subject: cvs: php4(apache_hooks) /main main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13684@lists.php.net to get a copy of this message
azzit Mon Aug 26 19:14:21 2002 EDT Modified files: (Branch: apache_hooks) /php4/main main.c Log: - put common sapi startup code into a function Index: php4/main/main.c diff -u php4/main/main.c:1.407.2.2 php4/main/main.c:1.407.2.3 --- php4/main/main.c:1.407.2.2 Mon Aug 26 16:02:18 2002 +++ php4/main/main.c Mon Aug 26 19:14:21 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.407.2.2 2002/08/26 20:02:18 gschlossnagle Exp $ */ +/* $Id: main.c,v 1.407.2.3 2002/08/26 23:14:21 azzit Exp $ */ /* {{{ includes */ @@ -813,14 +813,12 @@ static int php_hash_environment(TSRMLS_D); -/* {{{ php_request_startup +/* {{{ php_start_sapi() */ -int php_request_startup(TSRMLS_D) -{ - int retval = SUCCESS; -#if PHP_SIGCHILD - signal(SIGCHLD, sigchld_handler); -#endif +static int php_start_sapi() +{ + int retval = SUCCESS; + if(!SG(sapi_started)) { zend_try { PG(during_request_startup) = 1; @@ -837,11 +835,31 @@ } zend_catch { retval = FAILURE; } zend_end_try(); + SG(sapi_started) = 1; } + return retval; +} + +/* }}} */ + +/* {{{ php_request_startup + */ +int php_request_startup(TSRMLS_D) +{ + int retval = SUCCESS; + +#if PHP_SIGCHILD + signal(SIGCHLD, sigchld_handler); +#endif + + if (php_start_sapi() == FAILURE) + return FAILURE; + php_output_activate(TSRMLS_C); sapi_activate(TSRMLS_C); php_hash_environment(TSRMLS_C); + zend_try { if (PG(expose_php)) { sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1); @@ -869,25 +887,16 @@ int php_request_startup_for_hook(TSRMLS_D) { int retval = SUCCESS; + #if PHP_SIGCHLD signal(SIGCHLD, sigchld_handler); #endif - if(!SG(sapi_started)) { - zend_try { - PG(during_request_startup) = 1; - PG(modules_activated) = 0; - PG(header_is_being_sent) = 0; - PG(connection_status) = PHP_CONNECTION_NORMAL; - zend_activate(TSRMLS_C); - zend_activate_modules(TSRMLS_C); - PG(modules_activated) = 1; - } zend_catch { - retval = FAILURE; - } zend_end_try(); - SG(sapi_started) = 1; - } + + if (php_start_sapi() == FAILURE) + return FAILURE; + + php_output_activate(TSRMLS_C); sapi_activate(TSRMLS_C); - zend_set_timeout(EG(timeout_seconds)); php_hash_environment(TSRMLS_C); return retval;

« previous php.cvs (#13684) next »