splitbrain/php-archive
Pure-PHP implementation to read and write TAR and ZIP archives
1.5.1
1.6M downloads/mo
#3493 most downloaded on Packagist
splitbrain/php-archive
What this package is like to depend on
Last release 4 days ago
19 Aug 2026
Release timing varies
gaps range from 2 weeks to 2.7 years
Some releases are documented
notes for 8 of 23 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
23 releases · first in 2015
4 releases in the last 12 months
see the full history below
Release timeline
23 releases · Feb 2015 to Aug 2026Releases
latest 23-
1.5.119 Aug 2026Release notes
Open source →Zip::extract() trusted the sizes and the compression method from an
entry's headers before checking that the data was there.The copy loops padded short reads with pack('a'.$read_size, $buffer), so
a small archive could make extraction write a much larger file:- a stored entry declaring more bytes than the archive holds copied
central directory bytes and NUL padding past the end of the file, - a deflated entry declaring a large uncompressed size padded the
output up to that size, and - an archive written by "zip -fz" produced 4 GiB from 280 bytes,
because ZIP64 stores 0xFFFFFFFF in the 32 bit size fields.
Entries using neither store nor deflate ended up in the output as their
raw compressed data. zlib answers the faked gzip header of an unknown
method with the bytes unchanged instead of an error.Incomplete headers reached unpack(), which warned about the missing
input before the exception was thrown.Extraction now checks that an entry's data lies in front of the central
directory, fails on a short read instead of padding it, and rejects
unsupported compression methods. Entries that the include and exclude
filters skip stay unchecked, because their data is never read. All
headers are read through readRecord(), which refuses a short read.Regression tests cover each of these archives.
- a stored entry declaring more bytes than the archive holds copied
-
1.5.031 Jul 2026Release notes
Open source →Adding a directory produced an entry that no reader recognized as one, because its name was
stored without the trailing slash readers look for. Adding one through addFile() also tried
to read its content, which raised a notice and left a stray deflate remnant in the entry.Directories are now stored with a trailing slash and without content, so empty directories
survive a round trip and keep their mode. -
1.4.320 Jul 2026Release notes
Open source →writebytesAt() back-patches the CRC and sizes into a streamed local file
header. The in-memory branch appended the patched buffer to itself and
omitted the replacement length, so it duplicated data and left the header
fields at zero instead of overwriting them in place. This corrupted any
in-memory archive where an addFile() entry followed another entry; the
fault stayed hidden because the library and several tools read those
values from the central directory rather than the local header.Now the in-memory branch overwrites the header bytes in place, matching
the file-backed branch. -
1.4.213 May 2026Release notes
Open source →When a corrupt zip file is read, an exception should be thrown without
any previous notices and warnings leaking.This also introduces constants for a few magic numbers in the zip
format. -
1.4.101 Aug 2025 -
1.4.009 Dec 2024Nothing published for this version
-
1.3.123 Mar 2022Nothing published for this version
-
1.3.023 Mar 2022 -
1.2.122 Feb 2021Release notes
Open source →Existing tests didn't 100% make sure a zero byte file was correctly
added and extracted. It was. Now we also have the tests to prove it. -
1.2.013 Oct 2020Release notes
Open source →In PHP8,
matchis a reserved keyword. In preparation this renames the
method. A fallback via __call() is provided which will trigger a
E_USER_NOTICE. -
1.1.109 Sep 2018Nothing published for this version
-
1.1.012 Jun 2018Nothing published for this version
-
1.0.1001 May 2018Nothing published for this version
-
1.0.911 Jun 2017Nothing published for this version
-
1.0.819 Mar 2017Nothing published for this version
-
1.0.712 Aug 2015Nothing published for this version
-
1.0.612 Aug 2015Nothing published for this version
-
1.0.512 Aug 2015Nothing published for this version
-
1.0.424 Jul 2015Nothing published for this version
-
1.0.324 Jul 2015Nothing published for this version
-
1.0.230 Jun 2015Nothing published for this version
-
1.0.130 Jun 2015Nothing published for this version
-
1.0.025 Feb 2015Nothing published for this version