All notable changes to this project will be documented in this file.
The format is based on Common Changelog.
- Windows build support. Added
config.w32with automatic detection of optional static compression libraries (zlib, bzip2, lzma, lz4, zstd, OpenSSL) from a given install prefix. - CI: Linux test matrix. GitHub Actions workflow (
tests.yml) that runs the test suite across multiple PHP versions and variants (debug/release, ZTS/NTS) using Docker images, with JUnit artifact upload. - CI: Windows tests. Windows CI job in
tests.ymlthat builds and tests the extension on Windows usingphp/php-windows-builderand a statically-linked libarchive from vcpkg. - CI: Release workflow.
release.ymlbuilds Windows binaries for PHP 8.0–8.5 (x64) via vcpkg and uploads them as a GitHub draft release on version tags. libarchive.stub.php. Canonical PHP API definition file with full docblock documentation for all classes, methods, and constants. Used to generatelibarchive_arginfo.hviagen_stub.php.libarchive_arginfo.h. Generated header with typed argument info, method tables,register_class_*helpers, and aregister_libarchive_symbols()function replacing hand-writtenZEND_BEGIN_ARG_INFOmacros and constant registration.php_compat.h. Compatibility shim that back-portszend_register_internal_class_with_flags()for PHP versions before 8.4.composer.json. PIE (PHP Installer for Extensions) manifest, declaring the package ascataphract/libarchivewith thephp-exttype and a--with-libarchiveconfigure option.README.md. Usage examples for extracting to disk and reading an entry as a PHP stream, plus API and installation notes.Justfile. Developer task runner with recipes for building, testing, and updating Docker image SHAs..github/docker-image-shas.ymlandupdate-docker-shas.sh. Pinned Docker image SHAs for the CI matrix and a script to refresh them.- Test archive corpus. Added fixture archives covering all major formats (tar/ustar/GNU/pax, zip, 7-zip, cpio/odc/bin, cab, iso, rpm, xar, WARC, ar) and compression filters (gzip, bzip2, xz, lzma, lz4, zstd, lzo, lrzip, compress, uuencode, lzip).
tests/stream-all-formats.phpt. Test that reads the content of one entry from each fixture archive viacurrentEntryStream(), verifying all format/filter combinations work end to end.tests/stream-invalidation.phpt. Test that verifies a stream obtained fromcurrentEntryStream()emitsE_WARNINGand returns no data after the iterator has advanced to the next entry.entry_generationandcurrent_entry_sizefields inarch_object. Internal counters used to detect stale streams and to cap reads at the declared entry size.- Extension name is now "archive", matching the solib name "archive.so".
- Stream invalidation after iterator advance. A PHP stream returned by
currentEntryStream()is now considered stale as soon as the archive iterator moves to the next entry. Reading from a stale stream emitsE_WARNINGand returnsfalse, preventing silent corruption where data from a subsequent entry would be returned. - Stream reads capped at declared entry size.
php_arch_ops_read()now tracksremaining_bytes(initialised fromarchive_entry_size) and caps reads accordingly, ensuringstream_get_contents()terminates correctly instead of blocking or returning extra bytes. - File handle leak in
extractCurrent()on failure.archive_write_finish_entry()is now always called even whencopy_data()fails. Previously the open file handle was kept alive until theArchiveobject was freed, blockingunlink()on Windows. - Absolute path detection on Windows in
extractCurrent(). Replaced the Unix-onlypath[0] != '/'check with the PHP macroIS_ABSOLUTE_PATH(path, len), which also recognises Windows drive-letter and UNC paths. - Pathname compatibility with libarchive < 3.6.2.
archive_entry_update_pathname_utf8()is now used instead ofarchive_entry_set_pathname_utf8()when writing thepathnameproperty. Older libarchive versions (before commit d6248d2) did not fallback to UTF-8 when fetching the pathname causing an error due to the absence of any path. zval_dtor→zval_ptr_dtorinentry_oh_free_obj. The previous call decremented the refcount without running destructors; the correct function iszval_ptr_dtor.
- Minimum PHP version is now 8.0. All PHP 7.x compatibility guards have been
removed:
handler_this_t,handler_member_t,write_prop_ret_t,stream_ret_tassize_t,zend_string_release_p, the pre-7.3 iterator funcs setup, and the pre-8.0getIterator/zend_ce_traversablecode. - Extension internal name changed to
archive. Thezend_module_entry.namefield andconfig.w32 EXTENSION()call now use"archive"instead of"libarchive", aligning the extension name with theCOMPILE_DL_ARCHIVEsymbol and PHP convention. - Class registration uses generated stub code.
PHP_MINIT_FUNCTIONnow callsregister_class_libarchive_Exception(),register_class_libarchive_Archive(), andregister_class_libarchive_Entry()fromlibarchive_arginfo.h, replacing ad-hocINIT_CLASS_ENTRY/zend_register_internal_classblocks andREGISTER_EXTRACT_CONSTmacros.