From f9a39a9efaa8a0db459b44f89d70bdecd037538d Mon Sep 17 00:00:00 2001 From: Weilin Du Date: Fri, 16 Oct 2026 17:06:21 +0800 Subject: [PATCH 1/3] ext/zip: Reject broken libzip versions on Windows --- ext/zip/config.w32 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index 6f0644baaf99..4d29fb0efca8 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)"/m, zipconf_dir)) { + ERROR("libzip 1.3.1 and 1.7.0 are not supported. Please use another version."); + } + EXTENSION('zip', 'php_zip.c zip_stream.c'); ADD_EXTENSION_DEP('zip', 'pcre'); From 269e2d03b7bede350e92bfd59aa7d2365c5fe3a9 Mon Sep 17 00:00:00 2001 From: Weilin Du Date: Sat, 17 Oct 2026 12:22:55 +0800 Subject: [PATCH 2/3] add 1.12.0 --- ext/zip/config.w32 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/zip/config.w32 b/ext/zip/config.w32 index 4d29fb0efca8..b8e12b530b4e 100644 --- a/ext/zip/config.w32 +++ b/ext/zip/config.w32 @@ -12,8 +12,8 @@ if (PHP_ZIP != "no") { 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)"/m, zipconf_dir)) { - ERROR("libzip 1.3.1 and 1.7.0 are not supported. Please use another version."); + 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'); From b107dceb05ba3a2d5025c5ed70249b04e2680e8f Mon Sep 17 00:00:00 2001 From: Weilin Du Date: Sun, 18 Oct 2026 22:56:08 +0800 Subject: [PATCH 3/3] [skip ci] NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) 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