zip pecl.php.net A zip management extension Zip is an extension to create, modify and read zip files. Pierre-Alain Joye pajoye pajoye@php.net yes Remi Collet remi remi@php.net yes 2025-09-25 1.22.7 2.10.0 stable stable PHP-3.01 - compatibility with 8.5 - Fix leak when path is too long in ZipArchive::extractTo(). (nielsdos) - Fix memory leak in zip when encountering empty glob result. (nielsdos) - Fixed bug GH-19688 (Remove pattern overflow in zip addGlob()). (nielsdos) 5.6.0 8.5.99 1.7.0 zip 2025-05-07 1.22.6 2.10.0 stable stable PHP-3.01 - Fixed bug GH-17736 Assertion failure zend_reference_destroy (nielsdos) - Fixed bug GH-18304 Changing the properties through dynamic properties triggers a SegFault (nielsdos) - Fix uouv when handling empty options in ZipArchive::addGlob() (nielsdos) - Fix memory leak when handling a too long path in ZipArchive::addGlob() (nielsdos) - Fix GH-18431: Registering ZIP progress callback twice doesn't work (nielsdos) - Fix GH-18438: Handling of empty data and errors in ZipArchive::addPattern (nielsdos) - drop support for PHP 5.4 and 5.5 2025-02-20 1.22.5 2.10.0 stable stable PHP-3.01 - Fix zip_entry_name() crash on invalid entry 2024-09-26 1.22.4 2.10.0 stable stable PHP-3.01 - compatibility with 8.4 - add ZipArchive::ER_TRUNCATED_ZIP added in libzip 1.11 2023-11-14 1.22.3 2.10.0 stable stable PHP-3.01 - fix GH-12661 (Inconsistency in ZipArchive::addGlob 'remove_path' Option Behavior) 2023-08-23 1.22.2 2.10.0 stable stable PHP-3.01 - add ZipArchive::LENGTH_TO_END and ZipArchive::LENGTH_UNCHECKED constants with libzip 1.10.1 - use typed constants in 8.3 2023-06-29 1.22.1 2.10.0 stable stable PHP-3.01 - add more tests - ZipArchive::FL_RECOMPRESS constant is deprecated and will be removed in a future version of libzip - add ZipArchive::FL_OPEN_FILE_NOW to open the file when added instead of waiting for archive to be closed 2023-06-26 1.22.0 2.9.0 stable stable PHP 3.01 - compatibility with 8.3 - add new error macros (ER_DATA_LENGTH and ER_NOT_ALLOWED) with libzip >= 1.10.0 - add new archive global flags (ER_AFL_*) with libzip >= 1.10.0 - add ZipArchive::setArchiveFlag and ZipArchive::getArchiveFlag methods 2022-09-16 1.21.1 2.9.0 stable stable PHP 3.01 - PHP 8.2 compatibility 2022-06-28 1.21.0 2.9.0 stable stable PHP 3.01 - Fix GH-8781 #ZipArchive deletes zip file with no contents and doesn't update stat cache - implement fseek for zip stream when possible with libzip 1.9.1 - Allow 8.2 2022-05-02 1.20.1 2.9.0 stable stable PHP 3.01 - Fixed type for index in ZipArchive::replaceFile. (Martin Rehberger) 2021-10-12 1.20.0 2.9.0 stable stable PHP 3.01 - Fix #81490 ZipArchive::extractTo() may leak memory. (cmb, Remi) - Fix #77978 Dirname ending in colon unzips to wrong dir. (cmb) - add ZipArchive::clearError() method (Remi) - add ZipArchive::getStreamName() and ZipArchive::getStreamIndex methods (Remi) 2021-09-27 1.19.5 2.8.0 stable stable PHP 3.01 - Fix #81420 ZipArchive::extractTo extracts outside of destination (CVE-2021-21706) (cmb) 2021-09-01 1.19.4 2.8.0 stable stable PHP 3.01 - Fix #80833 ZipArchive::getStream doesn't use setPassword 2021-06-07 1.19.3 2.8.0 stable stable PHP 3.01 - Fix #80648 Fix for bug 79296 should be based on runtime version (cmb, Remi) - Fix #80863 ZipArchive::extractTo() ignores references. (cmb) 2020-11-23 1.19.2 2.8.0 stable stable PHP 3.01 - only display libzip both headers/library versions if they differ - report about ZSTD compression availability - Raise E_WARNING on PHP related errors (PHP 8) 2020-09-30 1.19.1 2.8.0 stable stable PHP 3.01 - encode parameter is optional (PHP 8) - deprecate procedural API with PHP 8 - promote warning to exception (PHP 8) - Fixed bug #79678 Build fails due to undeclared ZIP_RDONLY - add ZipArchive::CM_ZSTD constant (since libzip 1.8.0) 2020-06-05 1.19.0 2.8.0 stable stable PHP 3.01 - add ZipArchive::EM_TRAD_PKWARE and ZipArchive::EM_UNKNOWN constants - Fix #79424 don't use gl_pathc after call to globfree (Max Rees) - add ZipArchive::isCompressionMethodSupported() method (libzip 1.7.0) - add ZipArchive::isEncryptionMethodSupported() method (libzip 1.7.0) - initial PHP 8 support 2020-03-20 1.18.2 2.7.0 stable stable PHP 3.01 - Fixed Bug #79296 ZipArchive::open fails on empty file with libzip 1.6.0. 2020-03-19 1.18.1 2.7.0 stable stable PHP 3.01 - Implement #77960 add compression / encryption in ZipArchive::addGlob and ZipArchive::addPattern options parameter which now accepts: comp_method, comp_flags, enc_method and enc_password 2020-03-16 1.18.0 2.7.0 stable stable PHP 3.01 - add ZipArchive::FL_RECOMPRESS, FL_ENCRYPTED, FL_OVERWRITE, FL_LOCAL, FL_CENTRAL constants - add optional "flags" parameter to ZipArchive::addEmptyDir, addFile and addFromString methods - add "flags" options to ZipArchive::addGlob and addPattern methods, keeping previous behavior having FL_OVERWRITE by default - add ZipArchive::replaceFile() method - add lastId property to ZipArchive - make status, statusSys properties and ZipArchive::getStatusString() method available after archive is closed - Fixed bug #72374 remove_path option strips first char of filename - Fixed bug #50678 files extracted lost their original modified time 2020-02-28 1.17.2 2.6.0 stable stable PHP 3.01 - fix #79315 ZipArchive::addFile doen't honor start/length parameters 2020-02-03 1.17.1 2.6.0 stable stable PHP 3.01 - add ZipArchive::RDONLY constant (since libzip 1.0.0) - fix #73119 Wrong return for ZipArchive::addEmptyDir method 2020-01-31 1.17.0 2.6.0 stable stable PHP 3.01 - add ZipArchive::registerProgressCallback() method (since libzip 1.3.0) - add ZipArchive::registerCancelCallback() method (since libzip 1.6.0) - drop support for old PHP versions 2020-01-29 1.16.1 2.5.0 stable stable PHP 3.01 - add ZipArchive::CM_XZ constant (since libzip 1.6.0) - add ZipArchive::ER_* missing constants - fix Windows build 2020-01-28 1.16.0 2.5.0 stable stable PHP 3.01 - fix #78641 addGlob can modify given remove_path value - add ZipArchive::CM_LZMA2 constant (since libzip 1.6.0) - add ZipArchive::setMtimeName and ZipArchive::setMtimeIndex - add ZipArchive::LIBZIP_VERSION constant 2019-09-09 1.15.5 2.4.0 stable stable PHP 3.01 - Fix build with PHP 7.4 - Remove dead code - Replace deprecated libzip functions 2018-10-03 1.15.4 2.4.0 stable stable PHP 3.01 - Fixed Bug #76524 ZipArchive memory leak (OVERWRITE flag and empty archive) - Fixed incorrrecr zval_dtor() usage to replace value of argument passed by reference, that may lead to memory leaks. 2018-06-12 1.15.3 2.4.0 stable stable PHP 3.01 - Add OPSYS_CPM constant as documented - Fix build with PHP 7.3 2017-12-19 1.15.2 2.4.0 stable stable PHP 3.01 - fix bug #75540 Segfault with libzip 1.3.1 (double free) - display headers (buildtime) and library (runtime) versions in phpinfo (libzip >= 1.3.1) 2017-07-11 1.15.1 2.4.0 stable stable PHP 3.01 - fix segfault in php_stream_context_get_option call 2017-07-10 1.15.0 2.4.0 stable stable PHP 3.01 - ZipArchive implements Countable, added ZipArchive::count() method 2017-04-05 1.14.0 2.3.0 stable stable PHP 3.01 - Fix #70103: ZipArchive::addGlob ignores remove_all_path option (cmb) - add ZipArchive::setEncryptionName and ZipArchive::setEncryptionIndex methods available with libzip >= 1.2.0 (Remi) - add encryption_method in statIndex/statName returned array (Remi) - allow to set password in stream wrapper using context (Remi) - Fix #73803: Reflection of ZipArchive does not show public properties (Remi) - support for system libzip on Windows (Anatol) - drop bundled libzip, only support system library (Remi) 2016-10-14 1.13.5 2.2.0 stable stable PHP 3.01 - Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd). (Laruence) - Fixed bug #68302 (impossible to compile php with zip support). (cmb) - Fixed bug #70752 (Depacking with wrong password leaves 0 length files). (cmb) 2016-07-21 1.13.4 2.2.0 stable stable PHP 3.01 - Fixed bug #72520 (Stack-based buffer overflow vulnerability in php_stream_zip_opener). (Stas) 2016-06-23 1.13.3 2.2.0 stable stable PHP 3.01 - Fixed bug #71923 (integer overflow in ZipArchive::getFrom*). (CVE-2016-3078) (Stas) - Fixed bug #72258 (ZipArchive converts filenames to unrecoverable form). (Anatol) - Fixed bug #72434 (ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize). (CVE-2016-5773) (Dmitry) 2016-03-01 1.13.2 2.2.0 stable stable PHP 3.01 - Update bundled libzip to 1.1.2 (Remi, Anatol) - Fixed bug #71561 (NULL pointer dereference in Zip::ExtractTo) (Stas) - Format string fixes (Nikic) - Remove TSRMLS_* from code, they are not used anymore (Stas) - Fixed incorrect usage of HASH_OF() macro. (Dmitry) 2015-09-09 1.13.1 2.2.0 stable stable PHP 3.01 - fix pecl installaton 2015-09-07 1.13.0 2.2.0 stable stable PHP 3.01 - update bundled libzip to 1.0.1 (Remi, Anatol) - new methods for ZipArchive: setCompressionName, setCompressionIndex (Cedric Delmas) - allow to build with PHP 7 - Fixed bug #70350 (ZipArchive::extractTo allows for directory traversal when creating directories). (neal at fb dot com) - Fixed bug #70322 (ZipArchive::close() doesn't indicate errors). (cmb) 2015-04-15 1.12.5 2.1.0 stable stable PHP 3.01 - add OPSYS_Z_CPM missing constant - Fixed bug #69253 (ZIP Integer Overflow leads to writing past heap boundary). (CVE-2015-2331) (Stas) 2014-01-29 1.12.4 2.1.0 stable stable PHP License - bundled libzip version 0.11.2 - new methods for ZipArchive: setExternalAttributesName, setExternalAttributesIndex, getExternalAttributesName, getExternalAttributesIndex 2013-12-12 1.12.3 2.1.0 stable stable PHP License - clean all uses of private libzip structure - allow to build in php tree 2013-10-23 1.12.2 2.1.0 beta stable PHP License - fix build with PHP 5.3 - add --with-libzip configure option to use system libzip - move check before dereferencing ptr (Felipe) - add LICENSE and LICENSE_libzip - fix bug #64342 ZipArchive::addFile() has to check file existance 2013-04-29 1.12.1 2.1.0 beta stable PHP License - fix build on some linux - fix zip_set_file_compression 2013-04-01 1.12.0 2.1.0 beta stable PHP License - Added setPassword method, support for crypted archives . uncompress only . AES and ZipCrypto - fix VC9 builds (using bundled stdint) - fix preprocessor bug for ZipArchive::close method being renamed to _close on Windows 2013-04-01 1.11.0 2.1.0 beta stable PHP License - Added Zip64 support (large file support) - Added UTF-8 support for file names, file comments, and archive comments - Added zip_discard() - Added ZIP_TRUNCATE for zip_open() - Added zip_set_file_compression() 1.10.2 2.0.0 stable stable 2009-08-11 PHP License - #49072, feof never returns true for damaged file in zip - Fix possible crash when zip stream are used, the file entry stream was desroyed after the archive. 1.10.1 2.0.0 stable stable 2009-07-20 PHP License - #48763, ZipArchive produces corrupted archive (dani dot church at gmail dot com) - Fixed regression in the overwrite mode - Fixed binary mode with FCGI on Windows 1.10.0 2.0.0 stable stable 2008-12-24 PHP License - #12965, archive files with many root entries cannot be opened - #12414, extracting files from damaged archives - fix test for OOo stream test - Sync Code with 0.8.x (and port our php zip fixes) 1.9.1 2.0.0 alpha alpha 2007-01-18 PHP License - #40228, extractTo does not create recursive empty path (empty1/empty2/) 1.9.0 2.0.0 alpha alpha 2007-01-18 PHP License - fix some memleaks and double-free()s on error conditions (Nuno Lopes) - Add experimental support for addGlob and addPattern. They use respectively glob or regexp patterns to add entries. They also accept options like remove_path , add_path or remove_all_path. See the examples addglob and addpattern.php - requires pcre 1.8.4 2.0.0 stable stable 2006-12-17 PHP License - Use phplibdir in config.m4 (for lib64 or other custom location) - Add path length sanity checks (Ilia, Tony) - Update year, happy new year 1.8.3 2.0.0 stable stable 2006-12-17 PHP License - Fixed threadsafe issue with localtime function, it uses now the php php_localtime_r (Ron Korving, Ilia) 1.8.2 2.0.0 stable stable 2006-12-02 PHP License - restore compatibility with php 5.1.0 to 5.1.2 (other versions are not affected) 1.8.1 2.0.0 stable stable 2006-11-28 PHP License - PECL #9278, Binary access issues on Windows in any SAPI but CGI, CLI and embed (windows API does not respect "b" mode given to fopen) - Fixed a possible leak in the entries managements (Nuno Lopes) - createEmptyDir returns true one success - Use static for each internal functions when possible (Nuno Lopes) - Update protos in the sources 1.8.0 2.0.0 stable stable 2006-11-01 PHP License - Fixed a possible leak in statName and statIndex - Added zipArchive::adEmptyDir() method, creates an empty directory - Fixed setComment when used with a freshly added entry - setComment now returns the expected value (boolean) (Hannes) 1.7.5 2.0.0 stable stable 2006-10-25 PHP License - PECL Bug #9082, wrong entry name like "a/b//file.txt" cannot be extracted on windows A "bug" in php mkdir was the cause, a work around has been introduced for php versions before 5.2.0 1.7.4 2.0.0 stable stable 2006-09-27 PHP License - PHP Bug #38943, properties in extended class cannot be set - PHP Bug #38944, freshly created archive has no comment or cdir 1.7.3 2.0.0 stable stable 2006-09-16 PHP License - PECL Bug #8700, zipArchive::getFromIndex fails - PECL Bug #8676, zipArchive::addFile was not updated and still used VCWD_REALPATH, it now uses expand_filename - Fixed wrong internal types for comment lenghts, does not affect userland script (Nuno Lopes) 2.0.0 2.0.0 stable stable 2006-09-06 PHP License - Fix wrong internal types for comment lenghts, does not affect userland script (Nuno Lopes) 1.7.2 1.7.0 beta beta 2006-08-24 PHP License - Previous release was broken in non threaded environment. This release works smoothly in threaded and non threaded. Thanks to "FamilleCollet dot com" (Fedora-Extra maintainer for the head up) 1.7.1 1.7.0 beta beta 2006-08-24 - Fix issues with relative path in threaded environment, VCWD_REALPATH is used in ZipArchive::open() and ::addFile 1.7.0 1.7.0 beta beta 2006-07-14 PHP License - Add ZIPARCHIVE::OVERWRITE mode for ::open(), creates a new archive and write over an existing file - locateName do not change anymore the state, it can now be used to test an entry - fix possilbe crashes when two entries with the same name have been added - Enhanced safemode support - fix builds against php 6.0 (HEAD) - fix compiler warning (Ilia, Tony) - cleanup phpinfo() output (Ilia) 1.6.0 1.6.0 beta alpha 2006-07-14 PHP License - Rename Class Zip to ZipArchive, required to be bundled in php 5.2.0 (Zip being a ZipCode in US), making the role of this class more obvious *Gah* 1.5.0 1.5.0 alpha alpha 2006-07-14 PHP License - bring consistency to the method names: - rename zip::delete() to deleteIndex() - add zip::deleteName() - rename zip::statPath to zip::statName() - rename zip::rename to zip::renameIndex() - add zip::renameName(); - add zip::locateName(), returns the index of an entry, allows case insensitive or directory free lookup (ZIP::FL_NOCASE, ZIP::FL_NODIR) - add zip::unchangeName(), ::unchangeIndex(), unchangeAll() and unchangeArchive() revert changes to an entry, to all entries or the archive - add zip::getNameIndex(), get the name of the entry at the given position - Bug #7658, Modify zip archives causes corruption if the data descriptor is used (bit 3 of the general flags) - fix a bug when in the delete and rename methods when the index is lower than 1 - zip::addFile() must return true on success - zip::open() returns now the error code on error and true on success 1.4.1 1.4.0 alpha alpha 2006-06-28 PHP License - Add missing files in the package release 1.4.0 1.4.0 alpha alpha 2006-06-28 PHP License - Add write mode to the archive comment (zip::comment property) - Add zip::setCommentName and ::setCommentIndex, add or remove entrie comment - Add zip::getCommentName and ::getCommentIndex, get an entrie comment - Add zip::setArchiveComment - Full sync with zip-0.7.1 - #8009, modify archives on windows cannot be closed 1.3.1 1.3.0 alpha alpha 2006-04-26 PHP License - #7500, Fix build with php 5.1.0, 5.1.1 and 5.1.2 1.3.0 1.3.0 alpha alpha 2006-04-26 - Fix possible leak with __set/__get in classes extending the Zip intern object (tony2001[at]php.net) - Added getFromName(), return the contents of an entry using its name - Added getFromIndex(), return the contents of an entry using its index 1.2.3 1.2.1 alpha alpha 2006-03-30 PHP License - #7214, use binary safe string as return value, 0x00 was considered as the end of the content, affected only the procedural API 1.2.2 1.2.1 alpha alpha 2006-03-22 PHP License - fix a bug in internal zip_close, new archives were not written - ::open returns now false on error - update the "create.php" example, status and returned codes are now checked - fix a leak when the ::open method is called twice or more with the same object 1.2.1 1.2.1 alpha alpha 2006-03-19 PHP License - fixed a possible build problem (mkstemp missing) - fix a bug where extending the Zip class does allow to write to a property, see php bugs #36743 (array) 1.2.0 1.2.0 alpha alpha 2006-03-12 PHP License - enable stream by default, * use uri like zip:///path/to/my.zip#entryname.dat (the URI format may change in future version) - add support for print_r/var_dump (Zip object) - add tests for the OO (still need more) - add more example, like using xmlreader and zip stream to parse OpenDocument meta info 1.1.2 1.1.0 alpha alpha 2006-03-05 PHP License - do not create empty file when a zip entry is only a directory (empty or not) 1.1.1 1.1.0 alpha alpha 2006-03-02 PHP License - Fix PHP 5.1 detection at compiletie - fix possible build errors with gcc other than 4.0.x - add better zlib detection - "--with-zlib-dir=[DIR]" added 1.1.0 1.1.0 alpha alpha 2006-03-01 PHP License - replace the old zip extensions * 100% compatible with the old API * added zip creation support (write mode) * added OO interface * Stream support, getStream method returns a file handler - bundled libzip and drop zzlib usage (see http://www.nih.at/libzip/)