]> granicus.if.org Git - php/commitdiff
MFH: Fix a sigsegv on server shutdown, add missing sapi_shutdown().
authorUwe Schindler <thetaphi@php.net>
Mon, 23 Mar 2009 23:13:14 +0000 (23:13 +0000)
committerUwe Schindler <thetaphi@php.net>
Mon, 23 Mar 2009 23:13:14 +0000 (23:13 +0000)
sapi/nsapi/nsapi.c

index 95e07a41a2b33647659ff498bac652d7629a4c36..eea290b01c1f451cba155caacc5b4edafc851504 100644 (file)
@@ -468,6 +468,11 @@ static void sapi_nsapi_flush(void *server_context)
 {
        nsapi_request_context *rc = (nsapi_request_context *)server_context;
        TSRMLS_FETCH();
+       
+       if (!rc) {
+               /* we have no context, so no flushing needed. This fixes a SIGSEGV on shutdown */
+               return;
+       }
 
        if (!SG(headers_sent)) {
                sapi_send_headers(TSRMLS_C);
@@ -882,6 +887,7 @@ void NSAPI_PUBLIC php5_close(void *vparam)
        }
 #endif 
 
+       sapi_shutdown();
        tsrm_shutdown();
 
        log_error(LOG_INFORM, "php5_close", NULL, NULL, "Shutdown PHP Module");