From 32d83209813abd817f842acb54e2949c90427d42 Mon Sep 17 00:00:00 2001 From: Weilin Du Date: Fri, 16 Oct 2026 17:06:21 +0800 Subject: [PATCH 1/2] 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 620283a1d85d..b710fe400e66 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", "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'); if (get_define("LIBS_ZIP").match("libzip_a(?:_debug)?\.lib")) { From 55fe57d4ef076df8f61901c4294a9ca9e576f1f6 Mon Sep 17 00:00:00 2001 From: Weilin Du Date: Sat, 17 Oct 2026 12:22:55 +0800 Subject: [PATCH 2/2] 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 b710fe400e66..1dedfdb44650 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');