]> granicus.if.org Git - php/commitdiff
another startup initialization fix - only ISAPI and CGI SAPI's tested,
authorZeev Suraski <zeev@php.net>
Wed, 18 Sep 2002 21:57:42 +0000 (21:57 +0000)
committerZeev Suraski <zeev@php.net>
Wed, 18 Sep 2002 21:57:42 +0000 (21:57 +0000)
minor compile buglets might occur in other SAPIs, but should be trivial
to fix...

20 files changed:
main/main.c
main/php_main.h
sapi/activescript/php4activescript.c
sapi/aolserver/aolserver.c
sapi/apache/mod_php4.c
sapi/apache2filter/php_functions.c
sapi/apache2filter/sapi_apache2.c
sapi/caudium/caudium.c
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c
sapi/fastcgi/fastcgi.c
sapi/isapi/php4isapi.c
sapi/nsapi/nsapi.c
sapi/phttpd/phttpd.c
sapi/pi3web/pi3web_sapi.c
sapi/roxen/roxen.c
sapi/servlet/servlet.c
sapi/thttpd/thttpd.c
sapi/tux/php_tux.c
sapi/webjames/webjames.c

index 18d83c10fa21552893f1f19089898c0a01c20b15..1306414dd0f38c156c44a33691ca04e98bffdc58 100644 (file)
@@ -966,7 +966,7 @@ int php_startup_extensions(zend_module_entry **ptr, int count)
 
 /* {{{ php_module_startup
  */
-int php_module_startup(sapi_module_struct *sf)
+int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules)
 {
        zend_utility_functions zuf;
        zend_utility_values zuv;
@@ -1118,6 +1118,9 @@ int php_module_startup(sapi_module_struct *sf)
                php_printf("Unable to start builtin modules\n");
                return FAILURE;
        }
+       /* start additional PHP extensions */
+       php_startup_extensions(&additional_modules, num_additional_modules);
+
 
        /* load and startup extensions compiled as shared objects (aka DLLs)
           as requested by php.ini entries
@@ -1131,6 +1134,7 @@ int php_module_startup(sapi_module_struct *sf)
        /* disable certain functions as requested by php.ini */
        php_disable_functions(TSRMLS_C);
 
+       /* start Zend extensions */
        zend_startup_extensions();
 
 #ifdef ZTS
index 1e16496ca8f627f729b6ec2f50ecdb639baa65c1..dcf249020e4020e7a376d6e165fd06a9ab8f2808 100644 (file)
@@ -31,7 +31,7 @@
 PHPAPI int php_request_startup(TSRMLS_D);
 PHPAPI void php_request_shutdown(void *dummy);
 PHPAPI void php_request_shutdown_for_exec(void *dummy);
-PHPAPI int php_module_startup(sapi_module_struct *sf);
+PHPAPI int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules);
 PHPAPI void php_module_shutdown(TSRMLS_D);
 PHPAPI void php_module_shutdown_for_exec(void);
 PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
index eed1d7e52eb17130b9aadb952efb6ef9c99de180..a85cd625b9861dc7eecd1db6c3928bedef97c626 100644 (file)
@@ -30,8 +30,7 @@
 
 static int php_activescript_startup(sapi_module_struct *sapi_module)
 {
-       if (php_module_startup(sapi_module) == FAILURE ||
-                       zend_startup_module(&php_activescript_module) == FAILURE) {
+       if (php_module_startup(sapi_module, &php_activescript_module, 1) == FAILURE) {
                return FAILURE;
        } else {
                return SUCCESS;
index 0ce52e4c004e5086ab48ae742fdbbf78d2d92760..3131d69d712e2fbf8ff42f9246c9543d253b38bd 100644 (file)
@@ -277,8 +277,7 @@ PHP_FUNCTION(getallheaders)
 static int
 php_ns_startup(sapi_module_struct *sapi_module)
 {
-       if(php_module_startup(sapi_module) == FAILURE
-                       || zend_startup_module(&php_aolserver_module) == FAILURE) {
+       if (php_module_startup(sapi_module, &php_aolserver_module, 1) == FAILURE) {
                return FAILURE;
        } else {
                return SUCCESS;
index 26573a6065741dc96c824f25b15f4ba5bb6ba9d0..bbc95fb7ed7769ffa6722ea60f33d9ce437c2d34 100644 (file)
@@ -256,8 +256,7 @@ static void sapi_apache_register_server_variables(zval *track_vars_array TSRMLS_
  */
 static int php_apache_startup(sapi_module_struct *sapi_module)
 {
-       if (php_module_startup(sapi_module) == FAILURE
-               || zend_startup_module(&apache_module_entry) == FAILURE) {
+       if (php_module_startup(sapi_module, &apache_module_entry, 1) == FAILURE) {
                return FAILURE;
        } else {
                return SUCCESS;
index c04e0b938eddcd53983429026402a727b74e30e4..e7631266b2134d6548a49ffe2b7f16df6b56235c 100644 (file)
@@ -154,7 +154,7 @@ static function_entry apache_functions[] = {
        {NULL, NULL, NULL}
 };
 
-static zend_module_entry php_apache_module = {
+zend_module_entry php_apache_module = {
        STANDARD_MODULE_HEADER,
        "Apache 2.0",
        apache_functions,
index 9a63da69223b80de7324effa9dc1b6cc5e30f7b6..c8589e39ffe14a663afa518484fb4f8f10e698b5 100644 (file)
@@ -230,11 +230,22 @@ static void php_apache_sapi_log_message(char *msg)
        }
 }
 
+
+extern zend_module_entry php_apache_module;
+
+static int php_apache2_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, &php_apache_module, 1)==FAILURE) {
+               return FAILURE;
+       }
+       return SUCCESS;
+}
+
 static sapi_module_struct apache2_sapi_module = {
        "apache2filter",
        "Apache 2.0 Filter",
 
-       php_module_startup,                                             /* startup */
+       php_apache2_startup,                                            /* startup */
        php_module_shutdown_wrapper,                    /* shutdown */
 
        NULL,                                                                   /* activate */
index f0f0284ed23cc92fc9a32ecb718cd039edac618e..319670f039faed01f53ecf742b3d7349b3ec2829 100644 (file)
@@ -520,11 +520,21 @@ static void sapi_caudium_register_variables(zval *track_vars_array TSRMLS_DC)
   THREAD_SAFE_RUN(low_sapi_caudium_register_variables(track_vars_array TSRMLS_CC), "register_variables");
 }
 
+
+static int php_caudium_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, &php_caudium_module, 1)==FAILURE) {
+               return FAILURE;
+       }
+       return SUCCESS;
+}
+
+
 /* this structure is static (as in "it does not change") */
 static sapi_module_struct caudium_sapi_module = {
   "caudium",
   "Caudium",
-  php_module_startup,                  /* startup */
+  php_caudium_startup,                 /* startup */
   php_module_shutdown_wrapper,         /* shutdown */
   NULL,                                        /* activate */
   NULL,                                        /* deactivate */
@@ -762,7 +772,6 @@ void pike_module_init( void )
     ts_allocate_id(&caudium_globals_id, sizeof(php_caudium_request), NULL, NULL);
     sapi_startup(&caudium_sapi_module);
     sapi_module.startup(&caudium_sapi_module);
-    zend_startup_module(&php_caudium_module);
   }
   start_new_program(); /* Text */
   pike_add_function("run", f_php_caudium_request_handler,
index 28bfb21c893f7daa037b20afb42ba4944876a504..29ef0025b54728a5b7ca97175998bf3d914586e6 100644 (file)
@@ -296,6 +296,15 @@ static int sapi_cgi_deactivate(TSRMLS_D)
 }
 
 
+static int php_cgi_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+               return FAILURE;
+       }
+       return SUCCESS;
+}
+
+
 /* {{{ sapi_module_struct cgi_sapi_module
  */
 static sapi_module_struct cgi_sapi_module = {
@@ -306,7 +315,7 @@ static sapi_module_struct cgi_sapi_module = {
        "CGI",                                                  /* pretty name */
 #endif
        
-       php_module_startup,                             /* startup */
+       php_cgi_startup,                                /* startup */
        php_module_shutdown_wrapper,    /* shutdown */
 
        NULL,                                                   /* activate */
@@ -591,7 +600,7 @@ int main(int argc, char *argv[])
        cgi_sapi_module.executable_location = argv[0];
 
        /* startup after we get the above ini override se we get things right */
-       if (php_module_startup(&cgi_sapi_module)==FAILURE) {
+       if (php_module_startup(&cgi_sapi_module, NULL, 0)==FAILURE) {
 #ifdef ZTS
                tsrm_shutdown();
 #endif
index cf7ef0725df345bc893a002ac5a4d82e7d3f4250..ddfa66163b122edd5279d01862cdf44790a5e8ef 100644 (file)
@@ -200,13 +200,23 @@ static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_c
        PHPWRITE_H("\r\n", 2);
 }
 
+
+static int php_cli_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+               return FAILURE;
+       }
+       return SUCCESS;
+}
+
+
 /* {{{ sapi_module_struct cli_sapi_module
  */
 static sapi_module_struct cli_sapi_module = {
        "cli",                                                  /* name */
        "Command Line Interface",       /* pretty name */
 
-       php_module_startup,                             /* startup */
+       php_cli_startup,                                /* startup */
        php_module_shutdown_wrapper,    /* shutdown */
 
        NULL,                                                   /* activate */
@@ -421,7 +431,7 @@ int main(int argc, char *argv[])
        cli_sapi_module.executable_location = argv[0];
 
        /* startup after we get the above ini override se we get things right */
-       if (php_module_startup(&cli_sapi_module)==FAILURE) {
+       if (php_module_startup(&cli_sapi_module, NULL, 0)==FAILURE) {
                return FAILURE;
        }
 
index ccf57eb308f08cfc60dd61a16d7cdbfea12d104e..23fd8c0aec2d9e5122029513cb9d8e6a8fcac3b7 100644 (file)
@@ -174,11 +174,20 @@ static void sapi_fastcgi_log_message(char *message)
 }
 
 
+static int php_fastcgi_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+               return FAILURE;
+       }
+       return SUCCESS;
+}
+
+
 static sapi_module_struct fastcgi_sapi_module = {
        "fastcgi",
        "FastCGI",
        
-       php_module_startup,
+       php_fastcgi_startup,
        php_module_shutdown_wrapper,
        
        NULL,                                                                   /* activate */
@@ -444,7 +453,7 @@ int main(int argc, char *argv[])
        setmode(_fileno(stderr), O_BINARY);             /* make the stdio mode be binary */
 #endif
 
-       if (php_module_startup(&fastcgi_sapi_module)==FAILURE) {
+       if (php_module_startup(&fastcgi_sapi_module, NULL, 0)==FAILURE) {
                return FAILURE;
        }
 #ifdef ZTS
index 129c345f694d46eeeff769c5c2d76efb408cb403..9f2d3f296d1739a4f1abea0a818d7807860041ec 100644 (file)
@@ -296,8 +296,7 @@ static int sapi_isapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
 
 static int php_isapi_startup(sapi_module_struct *sapi_module)
 {
-       if (php_module_startup(sapi_module)==FAILURE
-               || zend_startup_module(&php_isapi_module)==FAILURE) {
+       if (php_module_startup(sapi_module, &php_isapi_module, 1)==FAILURE) {
                return FAILURE;
        } else {
                bTerminateThreadsOnError = (zend_bool) INI_INT("isapi.terminate_threads_on_error");
index 2a392ac434b7cb710e573a5187b4295265cb57a3..522df344797df9eb88eca047ca26c06ff6c7aa19 100644 (file)
@@ -342,11 +342,20 @@ nsapi_log_message(char *message)
 }
 
 
+static int php_nsapi_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+               return FAILURE;
+       }
+       return SUCCESS;
+}
+
+
 static sapi_module_struct nsapi_sapi_module = {
        "nsapi",                                /* name */
        "NSAPI",                                /* pretty name */
 
-       php_module_startup,                     /* startup */
+       php_nsapi_startup,                      /* startup */
        php_module_shutdown_wrapper,            /* shutdown */
 
        NULL,                                   /* activate */
index 7e7367d49d5ebb3ad2ef6f91c16a1cd5a2942091..415c691cc76daa84c8b615bfe3a2ef3ac77c2973 100644 (file)
@@ -43,13 +43,9 @@ static int ph_globals_id;
 static int
 php_phttpd_startup(sapi_module_struct *sapi_module)
 {
-/*
-    if(php_module_startup(sapi_module) == FAILURE
-            || zend_startup_module(&php_aolserver_module) == FAILURE) {
-*/
        fprintf(stderr,"***php_phttpd_startup\n");
 
-    if (php_module_startup(sapi_module)) {
+    if (php_module_startup(sapi_module, NULL, 0)) {
         return FAILURE;
     } else {
         return SUCCESS;
index 873e92127bc957a5a5f6a310de5dc3c5bdf4064d..e4b782f4f17af369aa0806899a4dee29d23f51e7 100644 (file)
@@ -215,8 +215,7 @@ static int sapi_pi3web_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
 
 static int php_pi3web_startup(sapi_module_struct *sapi_module)
 {
-       if (php_module_startup(sapi_module)==FAILURE
-               || zend_register_module(&php_pi3web_module)==FAILURE) {
+       if (php_module_startup(sapi_module, &php_pi3web_module, 1)==FAILURE) {
                return FAILURE;
        } else {
                return SUCCESS;
index 400fdc65074e102008b709260a6b7b545114f5e6..d86bb0917c2cd4888989dfd63baca5bb4c2c81a1 100644 (file)
@@ -473,8 +473,7 @@ static zend_module_entry php_roxen_module = {
 
 static int php_roxen_startup(sapi_module_struct *sapi_module)
 {
-  if(php_module_startup(sapi_module) == FAILURE
-     || zend_startup_module(&php_roxen_module) == FAILURE) {
+  if(php_module_startup(sapi_module, &php_roxen_module) == FAILURE) {
     return FAILURE;
   } else {
     return SUCCESS;
@@ -486,7 +485,7 @@ static int php_roxen_startup(sapi_module_struct *sapi_module)
 static sapi_module_struct roxen_sapi_module = {
   "roxen",
   "Roxen",
-  php_module_startup,                  /* startup */
+  php_roxen_startup,                   /* startup */
   php_module_shutdown_wrapper,         /* shutdown */
   NULL,                                        /* activate */
   NULL,                                        /* deactivate */
@@ -698,7 +697,7 @@ void pike_module_init( void )
 #endif  
 #endif
     sapi_startup(&roxen_sapi_module);
-    php_roxen_startup(&roxen_sapi_module);
+    /*php_roxen_startup(&roxen_sapi_module); removed - should be called from SAPI activation*/
     roxen_php_initialized = 1;
     PHP_INIT_LOCK();
   }
index 727dd9fe941484ace9621a0e55959bdb3172377f..538a603f8c7f96aa8ca77cec9c4324241e700313 100644 (file)
@@ -205,15 +205,25 @@ static char *sapi_servlet_read_cookies(TSRMLS_D)
 
 /***************************************************************************/
 
+
 /*
  * sapi maintenance
  */
 
+static int php_servlet_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+               return FAILURE;
+       } else {
+               return SUCCESS;
+       }
+}
+
 static sapi_module_struct servlet_sapi_module = {
        "java_servlet",                                 /* name */
        "Java Servlet",                                 /* pretty name */
                                                                        
-       php_module_startup,                             /* startup */
+       php_servlet_startup,                            /* startup */
        php_module_shutdown_wrapper,    /* shutdown */
 
        NULL,                                                   /* activate */
@@ -253,16 +263,10 @@ JNIEXPORT void JNICALL Java_net_php_servlet_startup
 
        sapi_startup(&servlet_sapi_module);
 
-       if (php_module_startup(&servlet_sapi_module)==FAILURE) {
+       if (php_module_startup(&servlet_sapi_module, additional_php_extensions, EXTCOUNT)==FAILURE) {
                ThrowServletException(jenv,"module startup failure");
                return;
        }
-
-       if (php_startup_extensions(additional_php_extensions, EXTCOUNT)==FAILURE) {
-               ThrowServletException(jenv,"extension startup failure");
-               return;
-       }
-
 }
 
 
index 1cda5a34f4e447754a47cd674f0d49b339a9fb21..896b4d71615820802b302f175e829681282e6e1e 100644 (file)
@@ -355,8 +355,7 @@ static zend_module_entry php_thttpd_module = {
 
 static int php_thttpd_startup(sapi_module_struct *sapi_module)
 {
-       if (php_module_startup(sapi_module) == FAILURE
-                       || zend_startup_module(&php_thttpd_module) == FAILURE) {
+       if (php_module_startup(sapi_module, &php_thttpd_module, 1) == FAILURE) {
                return FAILURE;
        }
        return SUCCESS;
index 4f0b6e17db8b4c6c6f009eb559d42335102e039d..0c0384de251911da9d6313b41a18d8c40d98aad3 100644 (file)
@@ -252,11 +252,21 @@ static void sapi_tux_register_variables(zval *track_vars_array TSRMLS_DC)
 #endif
 }
 
+
+static int php_tux_startup(sapi_module_struct *sapi_module)
+{
+       if (php_module_startup(sapi_module, NULL, 0)==FAILURE) {
+               return FAILURE;
+       } else {
+               return SUCCESS;
+       }
+}
+
 static sapi_module_struct tux_sapi_module = {
        "tux",
        "tux",
        
-       php_module_startup,
+       php_tux_startup,
        php_module_shutdown_wrapper,
        
        NULL,                                                                   /* activate */
index 3bea3457e48fc141e65badaf38058c3f4c3a0ebd..9d2f25013aecdf130738167ba67569225271687b 100644 (file)
@@ -242,10 +242,10 @@ static zend_module_entry php_webjames_module = {
   STANDARD_MODULE_PROPERTIES
 };
 
+
 static int php_webjames_startup(sapi_module_struct *sapi_module)
 {
-  if(php_module_startup(sapi_module) == FAILURE
-     || zend_startup_module(&php_webjames_module) == FAILURE) {
+  if(php_module_startup(sapi_module, &php_webjames_module, 1) == FAILURE) {
     return FAILURE;
   } else {
     return SUCCESS;