[php-src] PHP-8.4: Fix GH-24229: Use SHUT_WR when closing FastCGI connections (#24230)

From: Date: Sat, 10 Oct 2026 07:12:29 +0000
Subject: [php-src] PHP-8.4: Fix GH-24229: Use SHUT_WR when closing FastCGI connections (#24230)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142142@lists.php.net to get a copy of this message
Author: Ryosuke Ishibashi (mpyw) Committer: Weilin Du (LamentXU123) Date: 2026-10-10T15:05:37+08:00 Commit: https://github.com/php/php-src/commit/93a56ed537502c860a207ff5e7887716d919ef1f Raw diff: https://github.com/php/php-src/commit/93a56ed537502c860a207ff5e7887716d919ef1f.diff Fix GH-24229: Use SHUT_WR when closing FastCGI connections (#24230) fcgi_close() must shut down the write side before draining any remaining request data. The literal 1 matches SHUT_WR on supported platforms, but POSIX does not require that value. On WASI, 1 is SHUT_RD and SHUT_WR is 2. Shutting down reads makes the drain loop end immediately, so closing the socket with unread FCGI_STDIN data can reset the connection and discard the response. Use SHUT_WR from sys/socket.h in the non-Windows path. The Windows path continues to use 1, which is the correct value for SD_SEND. Closes #24230 Changed paths: M NEWS M main/fastcgi.c Diff: diff --git a/NEWS b/NEWS index 05dc5a7c733d..d4ed9198fe39 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,10 @@ PHP NEWS . Fixed bug GH-23352 (UAF reading an attribute value node retained across DOMDocument::adoptNode()). (David Carlier) +- FPM: + . Fixed bug GH-24229 (fcgi_close() passes shutdown() a literal 1, which is + SHUT_RD in WASI). (Ryosuke Ishibashi) + - Opcache: . Fixed bug GH-20890 (Segfault in zval_undefined_cv with non-simple property hook with minimal tracing JIT). (ndossche) diff --git a/main/fastcgi.c b/main/fastcgi.c index d1355d17fbee..f63210a59d97 100644 --- a/main/fastcgi.c +++ b/main/fastcgi.c @@ -1290,7 +1290,7 @@ void fcgi_close(fcgi_request *req, int force, int destroy) if (!force) { char buf[8]; - shutdown(req->fd, 1); + shutdown(req->fd, SHUT_WR); /* read any remaining data, it may be omitted */ while (recv(req->fd, buf, sizeof(buf), 0) > 0) {} }

« previous php.cvs (#142142) next »