From: Dmitry Stogov Date: Mon, 21 May 2007 09:08:25 +0000 (+0000) Subject: Fixed crash on "php -b 1234 -unknown-option" X-Git-Tag: RELEASE_1_4~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e25fd7ad9b3f04cb326b90620acacd3170fd0652;p=php Fixed crash on "php -b 1234 -unknown-option" --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 2487727aab..01f5ab758f 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1369,6 +1369,7 @@ consult the installation file that came with this distribution, or visit \n\ switch (c) { case 'h': case '?': + fcgi_shutdown(); no_headers = 1; php_output_tearup(); SG(headers_sent) = 1; @@ -1735,6 +1736,7 @@ fastcgi_request_done: } /* end of fastcgi loop */ } + fcgi_shutdown(); if (cgi_sapi_module.php_ini_path_override) { free(cgi_sapi_module.php_ini_path_override); diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c index 1c62eacd8d..8062e22a9d 100644 --- a/sapi/cgi/fastcgi.c +++ b/sapi/cgi/fastcgi.c @@ -177,6 +177,11 @@ int fcgi_in_shutdown(void) return in_shutdown; } +void fcgi_shutdown(void) +{ + is_fastcgi = 0; +} + int fcgi_init(void) { if (!is_initialized) { diff --git a/sapi/cgi/fastcgi.h b/sapi/cgi/fastcgi.h index a2fede78c2..1da8b05953 100644 --- a/sapi/cgi/fastcgi.h +++ b/sapi/cgi/fastcgi.h @@ -112,6 +112,7 @@ typedef struct _fcgi_request { } fcgi_request; int fcgi_init(void); +void fcgi_shutdown(void); int fcgi_is_fastcgi(void); int fcgi_in_shutdown(void); int fcgi_listen(const char *path, int backlog);