Repository navigation
Conversation
… callback. Fix php#23747 ZipArchive::close() called from a progress or cancel callback ran a nested zip_close() that failed, then zip_discard() freed the archive while the outer zip_close() from close() or open() was still using it. Track the close in progress and throw an Error from close() and open() meanwhile.
LamentXU123
approved these changes
Sep 18, 2026
damek24
pushed a commit
to damek24/php-src
that referenced
this pull request
Oct 8, 2026
A progress or cancel callback runs inside zip_close() after libzip has fixed the list of entries it writes. Deleting or unchanging an entry from the callback frees a dirent that zip_close() still uses. Other changes are either silently dropped or make close() fail and lose the archive. Reject archive mutations with the same "Already being closed" Error that close() and open() already raise, using php_zipobj_closing(). This follows phpGH-23749 and complements the destructor protection in phpGH-23779. Cover progress callbacks, cancel callbacks, and the implicit close() in open(), and verify that the archive contents are preserved. Closes php#24025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… callback.
Fix #23747
ZipArchive::close() called from a progress or cancel callback ran a nested zip_close() that failed, then zip_discard() freed the archive while the outer zip_close() from close() or open() was still using it. Track the close in progress and throw an Error from close() and open() meanwhile.