]> granicus.if.org Git - php/commitdiff
Fix a sigsegv on server shutdown, add missing sapi_shutdown().
authorUwe Schindler <thetaphi@php.net>
Fri, 20 Mar 2009 15:53:34 +0000 (15:53 +0000)
committerUwe Schindler <thetaphi@php.net>
Fri, 20 Mar 2009 15:53:34 +0000 (15:53 +0000)
!!! This should also be merged into 5.3, I prepared it, please tell me if it is ok to commit !!!

sapi/nsapi/nsapi.c

index 5ba67011a5c00eb6a8205636c4c36620934d3e7a..3d0a2f250e128460f53d07e0e1ec9a474120c7f2 100644 (file)
@@ -466,6 +466,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);
@@ -878,6 +883,7 @@ void NSAPI_PUBLIC php6_close(void *vparam)
        }
 #endif 
 
+       sapi_shutdown();
        tsrm_shutdown();
 
        log_error(LOG_INFORM, "php6_close", NULL, NULL, "Shutdown PHP Module");