From 0d194ec80b826110ee682fbff94820c0b8a2bddf Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Fri, 5 May 2000 07:21:48 +0000 Subject: [PATCH] - Fix problem with sapi_globals being used before it is initialized. --- sapi/cgi/cgi_main.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 96d844a1a0c..8ff2288aaf3 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -426,6 +426,19 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine #endif /* FORCE_CGI_REDIRECT */ } + if (php_module_startup(&sapi_module)==FAILURE) { + return FAILURE; + } +#ifdef ZTS + compiler_globals = ts_resource(compiler_globals_id); + executor_globals = ts_resource(executor_globals_id); + core_globals = ts_resource(core_globals_id); + sapi_globals = ts_resource(sapi_globals_id); + if (setjmp(EG(bailout))!=0) { + return -1; + } +#endif + if (!cgi) { while ((c=ap_php_getopt(argc, argv, "c:d:z:g:qvisnaeh?vf:"))!=-1) { switch (c) { @@ -443,20 +456,6 @@ any .htaccess restrictions anywhere on your site you can leave doc_root undefine ap_php_optind = orig_optind; ap_php_optarg = orig_optarg; } - - - if (php_module_startup(&sapi_module)==FAILURE) { - return FAILURE; - } -#ifdef ZTS - compiler_globals = ts_resource(compiler_globals_id); - executor_globals = ts_resource(executor_globals_id); - core_globals = ts_resource(core_globals_id); - sapi_globals = ts_resource(sapi_globals_id); - if (setjmp(EG(bailout))!=0) { - return -1; - } -#endif init_request_info(SLS_C); SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */