From 011fe21ca8bf064fa457c36f1516971d7109ca03 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 19 Oct 2025 22:13:12 +0200 Subject: [PATCH] phar: Fix file descriptor leak in phar_zip_flush() on failure. --- ext/phar/zip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/phar/zip.c b/ext/phar/zip.c index f1d0edd5bdff8..63c56108ed985 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -1246,6 +1246,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int return EOF; } if (phar->alias_len != php_stream_write(entry.fp, phar->alias, phar->alias_len)) { + php_stream_close(entry.fp); if (error) { spprintf(error, 0, "unable to set alias in zip-based phar \"%s\"", phar->fname); }