[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | ndossche | Date: | Tue, 22 Sep 2026 15:42:12 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141445@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-09-22T17:41:52+02:00
Commit: https://github.com/php/php-src/commit/1051af314b5eceae1f83285ea819055e85d53920
Raw diff: https://github.com/php/php-src/commit/1051af314b5eceae1f83285ea819055e85d53920.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix GH-23764: Built-in server leaks fd on HEAD request for static file
Changed paths:
M NEWS
M sapi/cli/php_cli_server.c
Diff:
diff --git a/NEWS b/NEWS
index cc47d3abdd3a..21b34cf655f8 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.6.0RC2
+- CLI:
+ . Fixed bug GH-23764 (Built-in server leaks a file descriptor on every HEAD
+ request for a static file). (jakubskopal)
24 Sep 2026, PHP 8.6.0RC1
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 9ccee510bb2c..485da7920360 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -2227,6 +2227,11 @@ static zend_result php_cli_server_begin_send_static(php_cli_server *server,
php_
client->content_sender_initialized = true;
if (client->request.request_method != PHP_HTTP_HEAD) {
client->file_fd = fd;
+ } else {
+ /* Content-Length comes from the stat and no body is sent, so the fd is
+ not needed; it is still opened so HEAD gets the same 404 as GET on
+ an unreadable file. */
+ close(fd);
}
{