summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-pecl-zip.spec78
-rw-r--r--upstream.patch438
-rw-r--r--zip-php84.patch186
3 files changed, 634 insertions, 68 deletions
diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec
index aa4658f..79a7d9f 100644
--- a/php-pecl-zip.spec
+++ b/php-pecl-zip.spec
@@ -3,7 +3,7 @@
#
# fedora spec file for php-pecl-zip
#
-# Copyright (c) 2013-2023 Remi Collet
+# Copyright (c) 2013-2024 Remi Collet
# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -12,11 +12,6 @@
%{?scl:%scl_package php-pecl-zip}
-# For PHP < 5.6 and EPEL-9
-%{!?__phpize: %global __phpize %{_bindir}/phpize}
-%{!?__ztsphpize: %global __ztsphpize %{_bindir}/zts-phpize}
-%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config}
-%{!?__ztsphpconfig:%global __ztsphpconfig %{_bindir}/zts-php-config}
%if ( 0%{?scl:1} && 0%{?rhel} == 8 ) || 0%{?rhel} >= 9
%bcond_without move_to_opt
@@ -47,12 +42,14 @@
Summary: A ZIP archive management extension
Name: %{?scl_prefix}php-pecl-zip
Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}}
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: PHP-3.01
Group: Development/Languages
URL: https://pecl.php.net/package/zip
Source0: https://pecl.php.net/get/%{sources}.tgz
+Patch0: upstream.patch
+Patch1: zip-php84.patch
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
@@ -66,14 +63,9 @@ Requires: %{?vendeur:%{vendeur}-}libzip%{?_isa} >= %{libzip_version}
%global __requires_exclude ^libzip\\.so.*$
%else
# Ensure latest version is used
-%if 0%{?rhel} == 7
-BuildRequires: libzip5-devel >= %{libzip_version}
-Requires: libzip5%{?_isa} >= %{libzip_version}
-%else
BuildRequires: libzip-devel >= %{libzip_version}
Requires: libzip%{?_isa} >= %{libzip_version}
%endif
-%endif
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
@@ -83,42 +75,6 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
Provides: %{?scl_prefix}php-%{pecl_name} = 1:%{version}-%{release}
Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = 1:%{version}-%{release}
-%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} == 7
-# Other third party repo stuff
-Obsoletes: php53-pecl-%{pecl_name} <= %{version}
-Obsoletes: php53u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php54-pecl-%{pecl_name} <= %{version}
-Obsoletes: php54w-pecl-%{pecl_name} <= %{version}
-%if "%{php_version}" > "5.5"
-Obsoletes: php55u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php55w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "5.6"
-Obsoletes: php56u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php56w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.0"
-Obsoletes: php70u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php70w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.1"
-Obsoletes: php71u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php71w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.2"
-Obsoletes: php72u-pecl-%{pecl_name} <= %{version}
-Obsoletes: php72w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.3"
-Obsoletes: php73-pecl-%{pecl_name} <= %{version}
-Obsoletes: php73w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.4"
-Obsoletes: php74-pecl-%{pecl_name} <= %{version}
-Obsoletes: php74w-pecl-%{pecl_name} <= %{version}
-%endif
-%endif
-
%if "%{php_version}" > "7.0"
Obsoletes: %{?scl_prefix}php-zip <= 7.0.0
%endif
@@ -141,6 +97,9 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd %{sources}
+%patch -P0 -p1
+%patch -P1 -p1
+
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_ZIP_VERSION/{s/.* "//;s/".*$//;p}' php7/php_zip.h)
if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}" -a "x${extver}" != "x%{upstream_version}-%{?upstream_prever}"; then
@@ -247,26 +206,6 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \
%endif
-%if 0%{?fedora} < 24 && 0%{?rhel} < 8
-# when pear installed alone, after us
-%triggerin -- %{?scl_prefix}php-pear
-if [ -x %{__pecl} ] ; then
- %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
-fi
-
-# posttrans as pear can be installed after us
-%posttrans
-if [ -x %{__pecl} ] ; then
- %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
-fi
-
-%postun
-if [ $1 -eq 0 -a -x %{__pecl} ] ; then
- %{pecl_uninstall} %{pecl_name} >/dev/null || :
-fi
-%endif
-
-
%files
%{?_licensedir:%license %{sources}/LICENSE}
%doc %{pecl_docdir}/%{pecl_name}
@@ -282,6 +221,9 @@ fi
%changelog
+* Thu Jul 4 2024 Remi Collet <remi@remirepo.net> - 1.22.3-2
+- add upstream patches for PHP 8.4
+
* Tue Nov 14 2023 Remi Collet <remi@remirepo.net> - 1.22.3-1
- update to 1.22.3
- build out of sources tree
diff --git a/upstream.patch b/upstream.patch
new file mode 100644
index 0000000..df227ac
--- /dev/null
+++ b/upstream.patch
@@ -0,0 +1,438 @@
+diff --git a/php5/php_zip.c b/php5/php_zip.c
+index 53427d9..f466748 100644
+--- a/php5/php_zip.c
++++ b/php5/php_zip.c
+@@ -154,7 +154,7 @@ static char * php_zip_make_relative_path(char *path, int path_len) /* {{{ */
+ #endif
+
+ /* {{{ php_zip_extract_file */
+-static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len TSRMLS_DC)
++static int php_zip_extract_file(struct zip * za, char *dest, const char *file, int file_len, zip_int64_t idx TSRMLS_DC)
+ {
+ php_stream_statbuf ssb;
+ struct zip_file *zf;
+@@ -173,6 +173,12 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
+ size_t path_cleaned_len;
+ cwd_state new_state;
+
++ if (idx <0) {
++ idx = zip_name_locate(za, file, 0);
++ if (idx < 0) {
++ return 0;
++ }
++ }
+ new_state.cwd = CWD_STATE_ALLOC(1);
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
+@@ -188,7 +194,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
+ }
+ path_cleaned_len = strlen(path_cleaned);
+
+- if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
++ if (path_cleaned_len >= MAXPATHLEN || zip_stat_index(za, idx, 0, &sb) != 0) {
+ CWD_STATE_FREE(new_state.cwd);
+ return 0;
+ }
+@@ -264,7 +270,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
+ return 0;
+ }
+
+- zf = zip_fopen(za, file, 0);
++ zf = zip_fopen_index(za, idx, 0);
+ if (zf == NULL) {
+ n = -1;
+ goto done;
+@@ -3164,7 +3170,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+
+ switch (Z_TYPE_P(zval_files)) {
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files), -1 TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -3179,7 +3185,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+ case IS_LONG:
+ break;
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file) TSRMLS_CC)) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file), -1 TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -3202,8 +3208,8 @@ static ZIPARCHIVE_METHOD(extractTo)
+ }
+
+ for (i = 0; i < filecount; i++) {
+- char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+- if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file) TSRMLS_CC)) {
++ const char *file = zip_get_name(intern, i, ZIP_FL_UNCHANGED);
++ if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file), i TSRMLS_CC)) {
+ RETURN_FALSE;
+ }
+ }
+diff --git a/php7/php_zip.c b/php7/php_zip.c
+index a13b127..f4188b7 100644
+--- a/php7/php_zip.c
++++ b/php7/php_zip.c
+@@ -137,7 +137,7 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
+ # define CWD_STATE_FREE(s) efree(s)
+
+ /* {{{ php_zip_extract_file */
+-static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len)
++static int php_zip_extract_file(struct zip * za, char *dest, const char *file, size_t file_len, zip_int64_t idx)
+ {
+ php_stream_statbuf ssb;
+ struct zip_file *zf;
+@@ -155,6 +155,12 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
+ cwd_state new_state;
+ zend_string *file_basename;
+
++ if (idx <0) {
++ idx = zip_name_locate(za, file, 0);
++ if (idx < 0) {
++ return 0;
++ }
++ }
+ new_state.cwd = CWD_STATE_ALLOC(1);
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
+@@ -170,7 +176,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
+ }
+ path_cleaned_len = strlen(path_cleaned);
+
+- if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
++ if (path_cleaned_len >= MAXPATHLEN || zip_stat_index(za, idx, 0, &sb) != 0) {
+ CWD_STATE_FREE(new_state.cwd);
+ return 0;
+ }
+@@ -245,7 +251,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil
+ return 0;
+ }
+
+- zf = zip_fopen(za, file, 0);
++ zf = zip_fopen_index(za, idx, 0);
+ if (zf == NULL) {
+ n = -1;
+ goto done;
+@@ -3062,7 +3068,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+
+ switch (Z_TYPE_P(zval_files)) {
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -3079,7 +3085,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+ case IS_LONG:
+ break;
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -3102,8 +3108,8 @@ static ZIPARCHIVE_METHOD(extractTo)
+ }
+
+ for (i = 0; i < filecount; i++) {
+- char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+- if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file))) {
++ const char *file = zip_get_name(intern, i, ZIP_FL_UNCHANGED);
++ if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file), i)) {
+ RETURN_FALSE;
+ }
+ }
+diff --git a/php73/php_zip.c b/php73/php_zip.c
+index 4b44fca..a6e1938 100644
+--- a/php73/php_zip.c
++++ b/php73/php_zip.c
+@@ -137,7 +137,7 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
+ # define CWD_STATE_FREE(s) efree(s)
+
+ /* {{{ php_zip_extract_file */
+-static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t file_len)
++static int php_zip_extract_file(struct zip * za, char *dest, const char *file, size_t file_len, zip_int64_t idx)
+ {
+ php_stream_statbuf ssb;
+ struct zip_file *zf;
+@@ -155,6 +155,12 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ cwd_state new_state;
+ zend_string *file_basename;
+
++ if (idx <0) {
++ idx = zip_name_locate(za, file, 0);
++ if (idx < 0) {
++ return 0;
++ }
++ }
+ new_state.cwd = CWD_STATE_ALLOC(1);
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
+@@ -170,7 +176,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ }
+ path_cleaned_len = strlen(path_cleaned);
+
+- if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
++ if (path_cleaned_len >= MAXPATHLEN || zip_stat_index(za, idx, 0, &sb) != 0) {
+ CWD_STATE_FREE(new_state.cwd);
+ return 0;
+ }
+@@ -245,7 +251,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ return 0;
+ }
+
+- zf = zip_fopen(za, file, 0);
++ zf = zip_fopen_index(za, idx, 0);
+ if (zf == NULL) {
+ n = -1;
+ goto done;
+@@ -3065,7 +3071,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+
+ switch (Z_TYPE_P(zval_files)) {
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -3081,7 +3087,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+ case IS_LONG:
+ break;
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -3104,8 +3110,8 @@ static ZIPARCHIVE_METHOD(extractTo)
+ }
+
+ for (i = 0; i < filecount; i++) {
+- char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+- if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file))) {
++ const char *file = zip_get_name(intern, i, ZIP_FL_UNCHANGED);
++ if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file), i)) {
+ RETURN_FALSE;
+ }
+ }
+diff --git a/php74/php_zip.c b/php74/php_zip.c
+index 36d8a0f..ebdda24 100644
+--- a/php74/php_zip.c
++++ b/php74/php_zip.c
+@@ -133,7 +133,7 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
+ # define CWD_STATE_FREE(s) efree(s)
+
+ /* {{{ php_zip_extract_file */
+-static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t file_len)
++static int php_zip_extract_file(struct zip * za, char *dest, const char *file, size_t file_len, zip_int64_t idx)
+ {
+ php_stream_statbuf ssb;
+ struct zip_file *zf;
+@@ -151,6 +151,12 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ cwd_state new_state;
+ zend_string *file_basename;
+
++ if (idx <0) {
++ idx = zip_name_locate(za, file, 0);
++ if (idx < 0) {
++ return 0;
++ }
++ }
+ new_state.cwd = CWD_STATE_ALLOC(1);
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
+@@ -166,7 +172,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ }
+ path_cleaned_len = strlen(path_cleaned);
+
+- if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
++ if (path_cleaned_len >= MAXPATHLEN || zip_stat_index(za, idx, 0, &sb) != 0) {
+ CWD_STATE_FREE(new_state.cwd);
+ return 0;
+ }
+@@ -241,7 +247,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ return 0;
+ }
+
+- zf = zip_fopen(za, file, 0);
++ zf = zip_fopen_index(za, idx, 0);
+ if (zf == NULL) {
+ n = -1;
+ goto done;
+@@ -2922,7 +2928,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+
+ switch (Z_TYPE_P(zval_files)) {
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -2938,7 +2944,7 @@ static ZIPARCHIVE_METHOD(extractTo)
+ case IS_LONG:
+ break;
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -2961,8 +2967,8 @@ static ZIPARCHIVE_METHOD(extractTo)
+ }
+
+ for (i = 0; i < filecount; i++) {
+- char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+- if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file))) {
++ const char *file = zip_get_name(intern, i, ZIP_FL_UNCHANGED);
++ if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file), i)) {
+ RETURN_FALSE;
+ }
+ }
+diff --git a/php8/php_zip.c b/php8/php_zip.c
+index 9de2d68..f2947b5 100644
+--- a/php8/php_zip.c
++++ b/php8/php_zip.c
+@@ -121,7 +121,7 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
+ # define CWD_STATE_FREE(s) efree(s)
+
+ /* {{{ php_zip_extract_file */
+-static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t file_len)
++static int php_zip_extract_file(struct zip * za, char *dest, const char *file, size_t file_len, zip_int64_t idx)
+ {
+ php_stream_statbuf ssb;
+ struct zip_file *zf;
+@@ -139,6 +139,12 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ cwd_state new_state;
+ zend_string *file_basename;
+
++ if (idx <0) {
++ idx = zip_name_locate(za, file, 0);
++ if (idx < 0) {
++ return 0;
++ }
++ }
+ new_state.cwd = CWD_STATE_ALLOC(1);
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
+@@ -154,7 +160,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ }
+ path_cleaned_len = strlen(path_cleaned);
+
+- if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
++ if (path_cleaned_len >= MAXPATHLEN || zip_stat_index(za, idx, 0, &sb) != 0) {
+ CWD_STATE_FREE(new_state.cwd);
+ return 0;
+ }
+@@ -229,7 +235,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ return 0;
+ }
+
+- zf = zip_fopen(za, file, 0);
++ zf = zip_fopen_index(za, idx, 0);
+ if (zf == NULL) {
+ n = -1;
+ goto done;
+@@ -2815,7 +2821,7 @@ PHP_METHOD(ZipArchive, extractTo)
+ uint32_t nelems, i;
+
+ if (files_str) {
+- if (!php_zip_extract_file(intern, pathto, ZSTR_VAL(files_str), ZSTR_LEN(files_str))) {
++ if (!php_zip_extract_file(intern, pathto, ZSTR_VAL(files_str), ZSTR_LEN(files_str), -1)) {
+ RETURN_FALSE;
+ }
+ } else if (files_ht) {
+@@ -2830,7 +2836,7 @@ PHP_METHOD(ZipArchive, extractTo)
+ case IS_LONG:
+ break;
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -2847,8 +2853,8 @@ PHP_METHOD(ZipArchive, extractTo)
+ }
+
+ for (i = 0; i < filecount; i++) {
+- char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+- if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file))) {
++ const char *file = zip_get_name(intern, i, ZIP_FL_UNCHANGED);
++ if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file), i)) {
+ RETURN_FALSE;
+ }
+ }
+diff --git a/php81/php_zip.c b/php81/php_zip.c
+index 35c3dee..ee92d34 100644
+--- a/php81/php_zip.c
++++ b/php81/php_zip.c
+@@ -126,7 +126,7 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
+ # define CWD_STATE_FREE(s) efree(s)
+
+ /* {{{ php_zip_extract_file */
+-static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t file_len)
++static int php_zip_extract_file(struct zip * za, char *dest, const char *file, size_t file_len, zip_int64_t idx)
+ {
+ php_stream_statbuf ssb;
+ struct zip_file *zf;
+@@ -144,6 +144,12 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ cwd_state new_state;
+ zend_string *file_basename;
+
++ if (idx <0) {
++ idx = zip_name_locate(za, file, 0);
++ if (idx < 0) {
++ return 0;
++ }
++ }
+ new_state.cwd = CWD_STATE_ALLOC(1);
+ new_state.cwd[0] = '\0';
+ new_state.cwd_length = 0;
+@@ -159,7 +165,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ }
+ path_cleaned_len = strlen(path_cleaned);
+
+- if (path_cleaned_len >= MAXPATHLEN || zip_stat(za, file, 0, &sb) != 0) {
++ if (path_cleaned_len >= MAXPATHLEN || zip_stat_index(za, idx, 0, &sb) != 0) {
+ CWD_STATE_FREE(new_state.cwd);
+ return 0;
+ }
+@@ -234,7 +240,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t
+ return 0;
+ }
+
+- zf = zip_fopen(za, file, 0);
++ zf = zip_fopen_index(za, idx, 0);
+ if (zf == NULL) {
+ n = -1;
+ goto done;
+@@ -2830,7 +2836,7 @@ PHP_METHOD(ZipArchive, extractTo)
+ uint32_t nelems, i;
+
+ if (files_str) {
+- if (!php_zip_extract_file(intern, pathto, ZSTR_VAL(files_str), ZSTR_LEN(files_str))) {
++ if (!php_zip_extract_file(intern, pathto, ZSTR_VAL(files_str), ZSTR_LEN(files_str), -1)) {
+ RETURN_FALSE;
+ }
+ } else if (files_ht) {
+@@ -2845,7 +2851,7 @@ PHP_METHOD(ZipArchive, extractTo)
+ case IS_LONG:
+ break;
+ case IS_STRING:
+- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file))) {
++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
+ RETURN_FALSE;
+ }
+ break;
+@@ -2862,8 +2868,8 @@ PHP_METHOD(ZipArchive, extractTo)
+ }
+
+ for (i = 0; i < filecount; i++) {
+- char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED);
+- if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file))) {
++ const char *file = zip_get_name(intern, i, ZIP_FL_UNCHANGED);
++ if (!file || !php_zip_extract_file(intern, pathto, file, strlen(file), i)) {
+ RETURN_FALSE;
+ }
+ }
diff --git a/zip-php84.patch b/zip-php84.patch
new file mode 100644
index 0000000..e50b9e0
--- /dev/null
+++ b/zip-php84.patch
@@ -0,0 +1,186 @@
+From d8814bb56c836d0d76f8353ef82c16b2f80ff9ca Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 24 Apr 2024 15:19:39 +0200
+Subject: [PATCH] compatibility with 8.4
+
+---
+ config.m4 | 4 ++--
+ config.w32 | 2 ++
+ package.xml | 4 ++--
+ 3 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index 97f687a..e196729 100644
+--- a/config.m4
++++ b/config.m4
+@@ -27,8 +27,8 @@ if test "$PHP_ZIP" != "no"; then
+ elif test $PHP_VERSION -lt 80100; then
+ AC_MSG_RESULT(8.0)
+ subdir=php8
+- elif test $PHP_VERSION -lt 80400; then
+- AC_MSG_RESULT(8.1/8.2/8.3)
++ elif test $PHP_VERSION -lt 80500; then
++ AC_MSG_RESULT(8.1/8.2/8.3/8.4)
+ subdir=php81
+ else
+ AC_MSG_ERROR(PHP version $PHP_VERSION is not supported yet)
+From d66c502aa9bba9aed8b553098e80ff9902207927 Mon Sep 17 00:00:00 2001
+From: Peter Kokot <peterkokot@gmail.com>
+Date: Sat, 1 Jun 2024 14:07:06 +0200
+Subject: [PATCH] Add missing pcre dependency definition to zip extension
+
+The zip extension also requires the pcre extension.
+---
+ config.m4 | 1 +
+ config.w32 | 1 +
+ php5/php_zip.c | 8 +++++++-
+ php7/php_zip.c | 8 +++++++-
+ php73/php_zip.c | 8 +++++++-
+ php74/php_zip.c | 8 +++++++-
+ php8/php_zip.c | 8 +++++++-
+ php81/php_zip.c | 8 +++++++-
+ 8 files changed, 44 insertions(+), 6 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index e196729..0b4669b 100644
+--- a/config.m4
++++ b/config.m4
+@@ -142,6 +142,7 @@ if test "$PHP_ZIP" != "no"; then
+
+ AC_DEFINE(HAVE_ZIP,1,[ ])
+ PHP_NEW_EXTENSION(zip, $PHP_ZIP_SOURCES, $ext_shared,, $LIBZIP_CFLAGS)
++ PHP_ADD_EXTENSION_DEP(zip, pcre)
+ else
+ AC_MSG_ERROR([libzip is no more bundled: install libzip version >= 0.11 (1.3.0 recommended for encryption and bzip2 support)])
+ fi
+diff --git a/php5/php_zip.c b/php5/php_zip.c
+index 0b61c0d..eccd1cc 100644
+--- a/php5/php_zip.c
++++ b/php5/php_zip.c
+@@ -1338,10 +1338,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip);
+ static PHP_MINFO_FUNCTION(zip);
+ /* }}} */
+
++static const zend_module_dep zip_deps[] = {
++ ZEND_MOD_REQUIRED("pcre")
++ ZEND_MOD_END
++};
++
+ /* {{{ zip_module_entry
+ */
+ zend_module_entry zip_module_entry = {
+- STANDARD_MODULE_HEADER,
++ STANDARD_MODULE_HEADER_EX, NULL,
++ zip_deps,
+ "zip",
+ zip_functions,
+ PHP_MINIT(zip),
+diff --git a/php7/php_zip.c b/php7/php_zip.c
+index 0470d52..aa8b71e 100644
+--- a/php7/php_zip.c
++++ b/php7/php_zip.c
+@@ -1226,10 +1226,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip);
+ static PHP_MINFO_FUNCTION(zip);
+ /* }}} */
+
++static const zend_module_dep zip_deps[] = {
++ ZEND_MOD_REQUIRED("pcre")
++ ZEND_MOD_END
++};
++
+ /* {{{ zip_module_entry
+ */
+ zend_module_entry zip_module_entry = {
+- STANDARD_MODULE_HEADER,
++ STANDARD_MODULE_HEADER_EX, NULL,
++ zip_deps,
+ "zip",
+ zip_functions,
+ PHP_MINIT(zip),
+diff --git a/php73/php_zip.c b/php73/php_zip.c
+index e56a94d..ee68b0f 100644
+--- a/php73/php_zip.c
++++ b/php73/php_zip.c
+@@ -1229,10 +1229,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip);
+ static PHP_MINFO_FUNCTION(zip);
+ /* }}} */
+
++static const zend_module_dep zip_deps[] = {
++ ZEND_MOD_REQUIRED("pcre")
++ ZEND_MOD_END
++};
++
+ /* {{{ zip_module_entry
+ */
+ zend_module_entry zip_module_entry = {
+- STANDARD_MODULE_HEADER,
++ STANDARD_MODULE_HEADER_EX, NULL,
++ zip_deps,
+ "zip",
+ zip_functions,
+ PHP_MINIT(zip),
+diff --git a/php74/php_zip.c b/php74/php_zip.c
+index 52ae83d..3c4c509 100644
+--- a/php74/php_zip.c
++++ b/php74/php_zip.c
+@@ -1241,10 +1241,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip);
+ static PHP_MINFO_FUNCTION(zip);
+ /* }}} */
+
++static const zend_module_dep zip_deps[] = {
++ ZEND_MOD_REQUIRED("pcre")
++ ZEND_MOD_END
++};
++
+ /* {{{ zip_module_entry
+ */
+ zend_module_entry zip_module_entry = {
+- STANDARD_MODULE_HEADER,
++ STANDARD_MODULE_HEADER_EX, NULL,
++ zip_deps,
+ "zip",
+ zip_functions,
+ PHP_MINIT(zip),
+diff --git a/php8/php_zip.c b/php8/php_zip.c
+index 34bddd1..93d633b 100644
+--- a/php8/php_zip.c
++++ b/php8/php_zip.c
+@@ -1141,10 +1141,16 @@ static PHP_MSHUTDOWN_FUNCTION(zip);
+ static PHP_MINFO_FUNCTION(zip);
+ /* }}} */
+
++static const zend_module_dep zip_deps[] = {
++ ZEND_MOD_REQUIRED("pcre")
++ ZEND_MOD_END
++};
++
+ /* {{{ zip_module_entry */
+ zend_module_entry zip_module_entry = {
+- STANDARD_MODULE_HEADER,
++ STANDARD_MODULE_HEADER_EX, NULL,
+ "zip",
++ zip_deps,
+ ext_functions,
+ PHP_MINIT(zip),
+ PHP_MSHUTDOWN(zip),
+diff --git a/php81/php_zip.c b/php81/php_zip.c
+index 274ddf1..97194ba 100644
+--- a/php81/php_zip.c
++++ b/php81/php_zip.c
+@@ -1156,9 +1156,15 @@ static PHP_MSHUTDOWN_FUNCTION(zip);
+ static PHP_MINFO_FUNCTION(zip);
+ /* }}} */
+
++static const zend_module_dep zip_deps[] = {
++ ZEND_MOD_REQUIRED("pcre")
++ ZEND_MOD_END
++};
++
+ /* {{{ zip_module_entry */
+ zend_module_entry zip_module_entry = {
+- STANDARD_MODULE_HEADER,
++ STANDARD_MODULE_HEADER_EX, NULL,
++ zip_deps,
+ "zip",
+ ext_functions,
+ PHP_MINIT(zip),