[php-src] master: Fix #22859 undefined symbol 'zip_file_set_encryption' (#22861)
Remi Collet via GitHub <[email protected]> Wed, 22 Jul 2026 17:03:54 +0000
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: Remi Collet (remicollet)
Committer: GitHub (web-flow)
Pusher: LamentXU123
Date: 2026-07-23T01:03:51+08:00
Commit: https://github.com/php/php-src/commit/b06dfa2acaabd6b39baa5b2583038984717a1d2e
Raw diff: https://github.com/php/php-src/commit/b06dfa2acaabd6b39baa5b2583038984717a1d2e.diff
Fix #22859 undefined symbol 'zip_file_set_encryption' (#22861)
Only when HAVE_ENCRYPTION is true, we can use the zip_file_set_encryption
function. This commit add a guard to the zip_file_set_encryption symbol.
Changed paths:
M ext/zip/php_zip.c
Diff:
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 48075ac0ec6b..a41007b7aa89 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -82,6 +82,7 @@ static bool php_zip_set_file_comment(struct zip *za, zip_uint64_t index, const c
# define add_ascii_assoc_string add_assoc_string
# define add_ascii_assoc_long add_assoc_long
+#ifdef HAVE_ENCRYPTION
static bool php_zip_file_set_encryption(struct zip *intern, zend_long index, zend_long method, char *password) {
// FIXME: is a workaround to reset/free the password in case of consecutive calls.
// when libzip 1.11.5 is available, we can save this call in this case.
@@ -92,6 +93,7 @@ static bool php_zip_file_set_encryption(struct zip *intern, zend_long index, zen
return (zip_file_set_encryption(intern, (zip_uint64_t)index, (zip_uint16_t)method, password) == 0);
}
+#endif
/* Flatten a path by making a relative path (to .)*/
static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */