[php-src] PR #23765: Fix GH-23764: Built-in server leaks fd on HEAD request for static file
| From: | jakubskopal | Date: | Sat, 19 Sep 2026 00:36:46 +0000 |
| Subject: | [php-src] PR #23765: Fix GH-23764: Built-in server leaks fd on HEAD request for static file | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38575@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23765
Author: jakubskopal
Fixes GH-23764.
php_cli_server_begin_send_static() opens the file, but for HEAD requests never stores
the descriptor in client->file_fd, so nothing closes it. Close it right away;
Content-Length comes from the stat and the body is never sent, so the descriptor is not
needed.
Verified with a --disable-all build: after 100 curl -I requests,
/proc/<pid>/fd holds 0 references to the served file (previously 100); HEAD and
GET responses unchanged.
Bug exists since 8.2 (#8215); targeting PHP-8.4 as the lowest branch still receiving bug fixes.