[wp-trac] [WordPress Trac] #59467: Close ZIP archives before returning in `_unzip_file_ziparchive()`.
WordPress Trac
noreply at wordpress.org
Wed Sep 27 16:29:52 UTC 2023
#59467: Close ZIP archives before returning in `_unzip_file_ziparchive()`.
----------------------------+--------------------------
Reporter: costdev | Owner: costdev
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.4
Component: Filesystem API | Version: 3.0
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: performance
----------------------------+--------------------------
Changes (by costdev):
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"56735" 56735]:
{{{
#!CommitTicketReference repository="" revision="56735"
Filesystem API: Free the archive in `_unzip_file_ziparchive()`.
There are several early returns in `_unzip_file_ziparchive()` which don't
close the archive prior to returning.
As this function is used in installation and upgrade processes which are
memory-intensive, this calls `ZipArchive::close()` to free the archive
prior to each early return. This excludes the first return which is a
result of a failure to open the archive, which is [https://github.com/nih-
at/libzip/blob/main/lib/zip_open.c#L62-L73 freed internally] when the
failure occurs.
References:
- PHP.net: [https://www.php.net/manual/en/ziparchive.open.php
ZipArchive::open()] and
[https://www.php.net/manual/en/ziparchive.close.php ZipArchive::close()]
- libzip: [https://libzip.org/documentation/zip_open.html zip_open()] and
[https://libzip.org/documentation/zip_close.html zip_close()]
Follow-up to: [13005], [13006], [13015], [13221], [14346] [25779].
Props azaozz, afragen, joemcgill, costdev.
Fixes #59467
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59467#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list