[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
| From: | ndossche | Date: | Tue, 22 Sep 2026 15:42:11 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141444@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-09-22T17:41:31+02:00
Commit: https://github.com/php/php-src/commit/e039ee923135729bc443a3946c741d42cbfac096
Raw diff: https://github.com/php/php-src/commit/e039ee923135729bc443a3946c741d42cbfac096.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
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 726f9ac812d9..d6ca8e92c101 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ PHP NEWS
- CLI
. Fix GH-22567 (Windows ZTS CLI SAPI should refresh its TSRMLS cache during
request activation). (matyhtf)
+ . Fixed bug GH-23764 (Built-in server leaks a file descriptor on every HEAD
+ request for a static file). (jakubskopal)
- DOM:
. Fixed use-after-free when re-constructing a DOMXPath whose php:function
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 843dfeab219c..663e10092461 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -2185,6 +2185,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);
}
{