php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #72185
Patch php_fix_bug_72185.patch revision 2018-09-04 09:38 UTC by kenny at kennynet dot co dot uk

Patch php_fix_bug_72185.patch for FPM related Bug #72185

Patch version 2018-09-04 09:38 UTC

Return to Bug #72185 | Download this patch
Patch Revisions:

Developer: kenny@kennynet.co.uk

--- a/main/fastcgi.c
+++ b/main/fastcgi.c
@@ -1505,7 +1505,13 @@
 	if (req->out_hdr) {
 		int len = (int)(req->out_pos - ((unsigned char*)req->out_hdr + sizeof(fcgi_header)));
 
-		req->out_pos += fcgi_make_header(req->out_hdr, (fcgi_request_type)req->out_hdr->type, req->id, len);
+		/* If the packet is empty then remove the header (fix: php-bug #72185). */
+		if (len == 0) {
+			req->out_pos = req->out_hdr;
+		} else {
+			req->out_pos += fcgi_make_header(req->out_hdr, (fcgi_request_type)req->out_hdr->type, req->id, len);
+		}
+
 		req->out_hdr = NULL;
 	}
 }
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 16 12:03:37 2021 UTC