[php-src] PHP-8.4: ext/zip: Reject broken libzip versions on Windows (#24371)

From: Date: Sun, 25 Oct 2026 16:28:54 +0000
Subject: [php-src] PHP-8.4: ext/zip: Reject broken libzip versions on Windows (#24371)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142720@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Committer: GitHub (web-flow) Pusher: LamentXU123 Date: 2026-10-26T00:28:51+08:00 Commit: https://github.com/php/php-src/commit/a1eb2f8fa15ffc74325ff76ca12dd9e5278afcd7 Raw diff: https://github.com/php/php-src/commit/a1eb2f8fa15ffc74325ff76ca12dd9e5278afcd7.diff ext/zip: Reject broken libzip versions on Windows (#24371) Six years ago in f3e6b12 we reject them in .m4 but sadly forget to reject them in .w32 Changed paths: M NEWS M ext/zip/config.w32 Diff: diff --git a/NEWS b/NEWS index 5116cc1aa161..bb57e074de65 100644 --- a/NEWS +++ b/NEWS @@ -184,6 +184,8 @@ PHP NEWS tidy::repairFile() rejecting null for $encoding. (lacatoire) - Zip: + . Reject broken libzip versions 1.3.1, 1.7.0 and 1.12.0 during Windows + configuration. (Weilin Du) . Excluded libzip 1.12.0 due to a regression preventing additions and replacements in torrentzip archives. (Weilin Du) . Fixed use-after-free when re-entering ZipArchive during destruction or diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index 6f0644baaf99..b8e12b530b4e 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -3,11 +3,19 @@ ARG_ENABLE("zip", "ZIP support", "yes,shared"); if (PHP_ZIP != "no") { + var zipconf_dir; if (CHECK_HEADER_ADD_INCLUDE("zip.h", "CFLAGS_ZIP", PHP_PHP_BUILD + "\\include;" + PHP_EXTRA_INCLUDES) && - CHECK_HEADER_ADD_INCLUDE("zipconf.h", "CFLAGS_ZIP", PHP_PHP_BUILD + "\\lib\\libzip\\include;" + PHP_EXTRA_LIBS + "\\libzip\\include;" + PHP_ZIP) && + (zipconf_dir = CHECK_HEADER_ADD_INCLUDE("zipconf.h", "CFLAGS_ZIP", PHP_PHP_BUILD + "\\lib\\libzip\\include;" + PHP_EXTRA_LIBS + "\\libzip\\include;" + PHP_ZIP)) && (PHP_ZIP_SHARED && CHECK_LIB("libzip.lib", "zip", PHP_ZIP) || CHECK_LIB("libzip_a.lib", "zip", PHP_ZIP) && CHECK_LIB("libbz2_a.lib", "zip", PHP_ZIP) && CHECK_LIB("zlib_a.lib;zs.lib", "zip", PHP_ZIP) && CHECK_LIB("liblzma_a.lib", "zip", PHP_ZIP)) ) { + if (zipconf_dir === true) { + zipconf_dir = search_paths("zipconf.h", WshShell.Environment("Process").Item("INCLUDE"), null); + } + if (GREP_HEADER("zipconf.h", /^\s*#\s*define\s+LIBZIP_VERSION\s+"(?:1\.3\.1|1\.7\.0|1\.12(?:\.0)?)"/m, zipconf_dir)) { + ERROR("libzip 1.3.1, 1.7.0 and 1.12.0 are not supported. Please use another version."); + } + EXTENSION('zip', 'php_zip.c zip_stream.c'); ADD_EXTENSION_DEP('zip', 'pcre');

« previous php.cvs (#142720) next »