[php-src] PR #20754: Fix bug #74154: Phar extractTo creates empty files

From: Date: Sun, 21 Dec 2025 14:51:13 +0000
Subject: [php-src] PR #20754: Fix bug #74154: Phar extractTo creates empty files
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-34341@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/20754 Author: ndossche The current code causes the phar entry to remain in the fname cache. This would be fine for uncompressed phars, but is a problem for compressed phars when they try to reopen the file pointer. The reopen code will try to use the compressed file pointer as if it were an uncompressed file pointer. In that case, for the given test, the file offsets are out of bounds for the compressed file pointer because they are the uncompressed offsets. This results in empty files. In other cases, it's possible to read compressed parts of the file that don't belong to that particular file. To solve this, we simply remove the phar entry from the fname cache if the file pointer was closed but the phar is compressed. This will make sure that reopening the phar will not go through the cache and instead opens up a fresh file pointer with the right decompression settings. Targeting 8.4 because 8.3 is almost out of bugfix support and I don't want to risk regressions.

« previous php.git-pulls (#34341) next »