]> granicus.if.org Git - php/commitdiff
Fix fastCGI breakage: due to calling flush on unitialized requests,
authorStanislav Malyshev <stas@php.net>
Thu, 6 May 2004 15:23:53 +0000 (15:23 +0000)
committerStanislav Malyshev <stas@php.net>
Thu, 6 May 2004 15:23:53 +0000 (15:23 +0000)
request was aborted unless ignore_user_abort is set

sapi/cgi/cgi_main.c

index 760101d9694a435d248a4d96ad35b513da07d04a..9624f92adb4c9bdd29e042cb6eff02387fecea52 100644 (file)
@@ -486,11 +486,17 @@ static void sapi_cgi_log_message(char *message)
 
 static int sapi_cgi_deactivate(TSRMLS_D)
 {
-       sapi_cgibin_flush(SG(server_context));
+       /* flush only when SAPI was started. The reasons are:
+               1. SAPI Deactivate is called from two places: module init and request shutdown
+               2. When the first call occurs and the request is not set up, flush fails on 
+                       FastCGI.
+       */
+       if(SG(sapi_started)) {
+               sapi_cgibin_flush(SG(server_context));
+       }
        return SUCCESS;
 }
 
-
 static int php_cgi_startup(sapi_module_struct *sapi_module)
 {
        if (php_module_startup(sapi_module, NULL, 0) == FAILURE) {