summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--sapi/cgi/cgi_main.c4
-rw-r--r--sapi/cgi/fastcgi.c5
-rw-r--r--sapi/cgi/fastcgi.h1
4 files changed, 12 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 761831cc16..6dc370886c 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ PHP NEWS
- Fixed bug #40451 (addAttribute() may crash when used with non-existent child
node). (Tony)
- Fixed bug #40428 (imagepstext() doesn't accept optional parameter). (Pierre)
+- Fixed bug #40414 (possible endless fork() loop when running fastcgi).
+ (Dmitry)
- Fixed bug #40410 (ext/posix does not compile on MacOS 10.3.9). (Tony)
- Fixed Bug #40352 (FCGI_WEB_SERVER_ADDRS function get lost). (Dmitry)
- Fixed bug #40236 (php -a function allocation eats memory). (Dmitry)
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 65c3e28dd1..f8375fd3c4 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1392,6 +1392,10 @@ consult the installation file that came with this distribution, or visit \n\
exit(1);
}
+ if (fcgi_in_shutdown()) {
+ exit(0);
+ }
+
while (parent) {
do {
#ifdef DEBUG_FASTCGI
diff --git a/sapi/cgi/fastcgi.c b/sapi/cgi/fastcgi.c
index 743c90eee9..06885bc244 100644
--- a/sapi/cgi/fastcgi.c
+++ b/sapi/cgi/fastcgi.c
@@ -164,6 +164,11 @@ static void fcgi_signal_handler(int signo)
#endif
+int fcgi_in_shutdown(void)
+{
+ return in_shutdown;
+}
+
int fcgi_init(void)
{
if (!is_initialized) {
diff --git a/sapi/cgi/fastcgi.h b/sapi/cgi/fastcgi.h
index 8a0c29f3dc..940a9be55b 100644
--- a/sapi/cgi/fastcgi.h
+++ b/sapi/cgi/fastcgi.h
@@ -110,6 +110,7 @@ typedef struct _fcgi_request {
int fcgi_init(void);
int fcgi_is_fastcgi(void);
+int fcgi_in_shutdown(void);
int fcgi_listen(const char *path, int backlog);
void fcgi_init_request(fcgi_request *req, int listen_socket);
int fcgi_accept_request(fcgi_request *req);