diff options
-rw-r--r-- | 0001-Fix-leak-when-path-is-too-long-in-ZipArchive-extract.patch | 103 | ||||
-rw-r--r-- | 0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch | 160 | ||||
-rw-r--r-- | 0001-fix-test-for-8.5.0beta2.patch | 24 | ||||
-rw-r--r-- | 0002-Fix-GH-19688-Remove-pattern-overflow-in-zip-addGlob.patch | 142 | ||||
-rw-r--r-- | 0003-regen-arginfo.patch | 160 | ||||
-rw-r--r-- | php-pecl-zip.spec | 11 |
6 files changed, 599 insertions, 1 deletions
diff --git a/0001-Fix-leak-when-path-is-too-long-in-ZipArchive-extract.patch b/0001-Fix-leak-when-path-is-too-long-in-ZipArchive-extract.patch new file mode 100644 index 0000000..0dd8ea1 --- /dev/null +++ b/0001-Fix-leak-when-path-is-too-long-in-ZipArchive-extract.patch @@ -0,0 +1,103 @@ +From c55973ad182906be1282257f1ba79b89ab9625a2 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Wed, 27 Aug 2025 09:54:34 +0200 +Subject: [PATCH 1/2] Fix leak when path is too long in ZipArchive::extractTo() + +Upstream 09c223de00af9b312e49db7bbc915aefaca5dbf8 +--- + php5/php_zip.c | 1 + + php7/php_zip.c | 1 + + php73/php_zip.c | 1 + + php74/php_zip.c | 1 + + php8/php_zip.c | 1 + + php81/php_zip.c | 1 + + php85/php_zip.c | 1 + + 7 files changed, 7 insertions(+) + +diff --git a/php5/php_zip.c b/php5/php_zip.c +index 08b4963..5dda462 100644 +--- a/php5/php_zip.c ++++ b/php5/php_zip.c +@@ -234,6 +234,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, i + return 0; + } else if (len > MAXPATHLEN) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); ++ efree(fullpath); + efree(file_dirname_fullpath); + efree(file_basename); + efree(new_state.cwd); +diff --git a/php7/php_zip.c b/php7/php_zip.c +index b660b33..bffed61 100644 +--- a/php7/php_zip.c ++++ b/php7/php_zip.c +@@ -233,6 +233,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s + return 0; + } else if (len > MAXPATHLEN) { + php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); ++ efree(fullpath); + efree(file_dirname_fullpath); + zend_string_release(file_basename); + CWD_STATE_FREE(new_state.cwd); +diff --git a/php73/php_zip.c b/php73/php_zip.c +index 9dd4ac2..0635a84 100644 +--- a/php73/php_zip.c ++++ b/php73/php_zip.c +@@ -233,6 +233,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s + return 0; + } else if (len > MAXPATHLEN) { + php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); ++ efree(fullpath); + efree(file_dirname_fullpath); + zend_string_release_ex(file_basename, 0); + CWD_STATE_FREE(new_state.cwd); +diff --git a/php74/php_zip.c b/php74/php_zip.c +index 5754dd9..0cd33ad 100644 +--- a/php74/php_zip.c ++++ b/php74/php_zip.c +@@ -229,6 +229,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s + return 0; + } else if (len > MAXPATHLEN) { + php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); ++ efree(fullpath); + efree(file_dirname_fullpath); + zend_string_release_ex(file_basename, 0); + CWD_STATE_FREE(new_state.cwd); +diff --git a/php8/php_zip.c b/php8/php_zip.c +index dc5f539..5328c25 100644 +--- a/php8/php_zip.c ++++ b/php8/php_zip.c +@@ -217,6 +217,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s + return 0; + } else if (len > MAXPATHLEN) { + php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); ++ efree(fullpath); + efree(file_dirname_fullpath); + zend_string_release_ex(file_basename, 0); + CWD_STATE_FREE(new_state.cwd); +diff --git a/php81/php_zip.c b/php81/php_zip.c +index 3746ff5..ddcf47f 100644 +--- a/php81/php_zip.c ++++ b/php81/php_zip.c +@@ -226,6 +226,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s + return 0; + } else if (len > MAXPATHLEN) { + php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); ++ efree(fullpath); + efree(file_dirname_fullpath); + zend_string_release_ex(file_basename, 0); + CWD_STATE_FREE(new_state.cwd); +diff --git a/php85/php_zip.c b/php85/php_zip.c +index 450c297..d5f7b01 100644 +--- a/php85/php_zip.c ++++ b/php85/php_zip.c +@@ -211,6 +211,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s + return 0; + } else if (len > MAXPATHLEN) { + php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN); ++ efree(fullpath); + efree(file_dirname_fullpath); + zend_string_release_ex(file_basename, 0); + CWD_STATE_FREE(new_state.cwd); +-- +2.51.0 + diff --git a/0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch b/0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch new file mode 100644 index 0000000..1950f49 --- /dev/null +++ b/0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch @@ -0,0 +1,160 @@ +From 93046609eae6d4c9d57761863cc2bc590a6355e7 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 18 Sep 2025 11:08:36 +0200 +Subject: [PATCH 1/4] Fix memory leak in zip when encountering empty glob + result + +From https://github.com/php/php-src/commit/216e87ad7e33fda75f33e31c36a30b04b90e4696 +--- + php5/php_zip.c | 2 -- + php7/php_zip.c | 2 -- + php73/php_zip.c | 2 -- + php74/php_zip.c | 2 -- + php8/php_zip.c | 2 -- + php81/php_zip.c | 2 -- + php85/php_zip.c | 2 -- + 7 files changed, 14 deletions(-) + +diff --git a/php5/php_zip.c b/php5/php_zip.c +index 5dda462..8d16d3b 100644 +--- a/php5/php_zip.c ++++ b/php5/php_zip.c +@@ -706,7 +706,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -715,7 +714,6 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php7/php_zip.c b/php7/php_zip.c +index bffed61..d962618 100644 +--- a/php7/php_zip.c ++++ b/php7/php_zip.c +@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php73/php_zip.c b/php73/php_zip.c +index 0635a84..eb2c5b6 100644 +--- a/php73/php_zip.c ++++ b/php73/php_zip.c +@@ -668,7 +668,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -677,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php74/php_zip.c b/php74/php_zip.c +index 0cd33ad..f987056 100644 +--- a/php74/php_zip.c ++++ b/php74/php_zip.c +@@ -664,7 +664,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -673,7 +672,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php8/php_zip.c b/php8/php_zip.c +index 5328c25..8129c15 100644 +--- a/php8/php_zip.c ++++ b/php8/php_zip.c +@@ -674,7 +674,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -683,7 +682,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php81/php_zip.c b/php81/php_zip.c +index ddcf47f..8bc582d 100644 +--- a/php81/php_zip.c ++++ b/php81/php_zip.c +@@ -676,7 +676,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -685,7 +684,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +diff --git a/php85/php_zip.c b/php85/php_zip.c +index d5f7b01..604b403 100644 +--- a/php85/php_zip.c ++++ b/php85/php_zip.c +@@ -628,7 +628,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + can be used for simple glob() calls without further error + checking. + */ +- array_init(return_value); + return 0; + } + #endif +@@ -637,7 +636,6 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + + /* now catch the FreeBSD style of "no matches" */ + if (!globbuf.gl_pathc || !globbuf.gl_pathv) { +- array_init(return_value); + return 0; + } + +-- +2.51.0 + diff --git a/0001-fix-test-for-8.5.0beta2.patch b/0001-fix-test-for-8.5.0beta2.patch new file mode 100644 index 0000000..e51be1f --- /dev/null +++ b/0001-fix-test-for-8.5.0beta2.patch @@ -0,0 +1,24 @@ +From 33d98e7efc25cf79f9969a93131e1b5ff976eb31 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Wed, 27 Aug 2025 09:50:06 +0200 +Subject: [PATCH] fix test for 8.5.0beta2 + +--- + tests/bug53603.phpt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/bug53603.phpt b/tests/bug53603.phpt +index 76b8ad9..dcbbeba 100644 +--- a/tests/bug53603.phpt ++++ b/tests/bug53603.phpt +@@ -31,6 +31,6 @@ var_dump($a); + + --EXPECTF-- + +-Warning: ZipArchive::extractTo(teststream://test/foo): %sailed to open stream: "TestStream::stream_open" call failed in %s on line %d ++Warning: ZipArchive::extractTo(teststream://test/foo): %sailed to open stream: "TestStream::stream_open" %s on line %d + bool(false) + +-- +2.51.0 + diff --git a/0002-Fix-GH-19688-Remove-pattern-overflow-in-zip-addGlob.patch b/0002-Fix-GH-19688-Remove-pattern-overflow-in-zip-addGlob.patch new file mode 100644 index 0000000..cdff431 --- /dev/null +++ b/0002-Fix-GH-19688-Remove-pattern-overflow-in-zip-addGlob.patch @@ -0,0 +1,142 @@ +From fa331a32d499b895aa836040b88f70697bf4ba9c Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 18 Sep 2025 11:17:58 +0200 +Subject: [PATCH 2/4] Fix GH-19688: Remove pattern overflow in zip addGlob() + +From https://github.com/php/php-src/commit/901f71e6e3a9c97928a8c32ab7e70bd52e93819c#diff-7ee66c4f1536ac84dc5bbff1b8312e2eef24b974b3e48a5c5c2bcfdf2eb8f3ce +--- + package.xml | 2 ++ + php5/php_zip.c | 2 +- + php7/php_zip.c | 2 +- + php73/php_zip.c | 2 +- + php74/php_zip.c | 2 +- + php8/php_zip.c | 2 +- + php81/php_zip.c | 2 +- + php85/php_zip.c | 2 +- + tests/gh19688.phpt | 23 +++++++++++++++++++++++ + 9 files changed, 32 insertions(+), 7 deletions(-) + create mode 100644 tests/gh19688.phpt + +diff --git a/php5/php_zip.c b/php5/php_zip.c +index 8d16d3b..8773944 100644 +--- a/php5/php_zip.c ++++ b/php5/php_zip.c +@@ -1968,7 +1968,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* + php_basename(Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file), NULL, 0, + &basename, (size_t *)&file_stripped_len TSRMLS_CC); + file_stripped = basename; +- } else if (opts.remove_path && !memcmp(Z_STRVAL_PP(zval_file), opts.remove_path, opts.remove_path_len)) { ++ } else if (opts.remove_path && Z_STRLEN_PP(zval_file) > opts.remove_path_len && !memcmp(Z_STRVAL_PP(zval_file), opts.remove_path, opts.remove_path_len)) { + if (IS_SLASH(Z_STRVAL_PP(zval_file)[opts.remove_path_len])) { + file_stripped = Z_STRVAL_PP(zval_file) + opts.remove_path_len + 1; + file_stripped_len = Z_STRLEN_PP(zval_file) - opts.remove_path_len - 1; +diff --git a/php7/php_zip.c b/php7/php_zip.c +index d962618..6363728 100644 +--- a/php7/php_zip.c ++++ b/php7/php_zip.c +@@ -1896,7 +1896,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0); + file_stripped = ZSTR_VAL(basename); + file_stripped_len = ZSTR_LEN(basename); +- } else if (opts.remove_path && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { ++ } else if (opts.remove_path && Z_STRLEN_P(zval_file) > opts.remove_path_len && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { + if (IS_SLASH(Z_STRVAL_P(zval_file)[opts.remove_path_len])) { + file_stripped = Z_STRVAL_P(zval_file) + opts.remove_path_len + 1; + file_stripped_len = Z_STRLEN_P(zval_file) - opts.remove_path_len - 1; +diff --git a/php73/php_zip.c b/php73/php_zip.c +index eb2c5b6..63715e7 100644 +--- a/php73/php_zip.c ++++ b/php73/php_zip.c +@@ -1899,7 +1899,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0); + file_stripped = ZSTR_VAL(basename); + file_stripped_len = ZSTR_LEN(basename); +- } else if (opts.remove_path && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { ++ } else if (opts.remove_path && Z_STRLEN_P(zval_file) > opts.remove_path_len && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { + if (IS_SLASH(Z_STRVAL_P(zval_file)[opts.remove_path_len])) { + file_stripped = Z_STRVAL_P(zval_file) + opts.remove_path_len + 1; + file_stripped_len = Z_STRLEN_P(zval_file) - opts.remove_path_len - 1; +diff --git a/php74/php_zip.c b/php74/php_zip.c +index f987056..17f5476 100644 +--- a/php74/php_zip.c ++++ b/php74/php_zip.c +@@ -1884,7 +1884,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0); + file_stripped = ZSTR_VAL(basename); + file_stripped_len = ZSTR_LEN(basename); +- } else if (opts.remove_path && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { ++ } else if (opts.remove_path && Z_STRLEN_P(zval_file) > opts.remove_path_len && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { + if (IS_SLASH(Z_STRVAL_P(zval_file)[opts.remove_path_len])) { + file_stripped = Z_STRVAL_P(zval_file) + opts.remove_path_len + 1; + file_stripped_len = Z_STRLEN_P(zval_file) - opts.remove_path_len - 1; +diff --git a/php8/php_zip.c b/php8/php_zip.c +index 8129c15..d3516f8 100644 +--- a/php8/php_zip.c ++++ b/php8/php_zip.c +@@ -1786,7 +1786,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0); + file_stripped = ZSTR_VAL(basename); + file_stripped_len = ZSTR_LEN(basename); +- } else if (opts.remove_path && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { ++ } else if (opts.remove_path && Z_STRLEN_P(zval_file) > opts.remove_path_len && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { + if (IS_SLASH(Z_STRVAL_P(zval_file)[opts.remove_path_len])) { + file_stripped = Z_STRVAL_P(zval_file) + opts.remove_path_len + 1; + file_stripped_len = Z_STRLEN_P(zval_file) - opts.remove_path_len - 1; +diff --git a/php81/php_zip.c b/php81/php_zip.c +index 8bc582d..7316643 100644 +--- a/php81/php_zip.c ++++ b/php81/php_zip.c +@@ -1806,7 +1806,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0); + file_stripped = ZSTR_VAL(basename); + file_stripped_len = ZSTR_LEN(basename); +- } else if (opts.remove_path && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { ++ } else if (opts.remove_path && Z_STRLEN_P(zval_file) > opts.remove_path_len && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { + if (IS_SLASH(Z_STRVAL_P(zval_file)[opts.remove_path_len])) { + file_stripped = Z_STRVAL_P(zval_file) + opts.remove_path_len + 1; + file_stripped_len = Z_STRLEN_P(zval_file) - opts.remove_path_len - 1; +diff --git a/php85/php_zip.c b/php85/php_zip.c +index 604b403..4fcb66f 100644 +--- a/php85/php_zip.c ++++ b/php85/php_zip.c +@@ -1742,7 +1742,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* + basename = php_basename(Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), NULL, 0); + file_stripped = ZSTR_VAL(basename); + file_stripped_len = ZSTR_LEN(basename); +- } else if (opts.remove_path && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { ++ } else if (opts.remove_path && Z_STRLEN_P(zval_file) > opts.remove_path_len && !memcmp(Z_STRVAL_P(zval_file), opts.remove_path, opts.remove_path_len)) { + if (IS_SLASH(Z_STRVAL_P(zval_file)[opts.remove_path_len])) { + file_stripped = Z_STRVAL_P(zval_file) + opts.remove_path_len + 1; + file_stripped_len = Z_STRLEN_P(zval_file) - opts.remove_path_len - 1; +diff --git a/tests/gh19688.phpt b/tests/gh19688.phpt +new file mode 100644 +index 0000000..09513a9 +--- /dev/null ++++ b/tests/gh19688.phpt +@@ -0,0 +1,23 @@ ++--TEST-- ++GH-19688 (Remove pattern overflow in zip addGlob()) ++--SKIPIF-- ++<?php ++if (!extension_loaded('zip')) die('skip'); ++?> ++--FILE-- ++<?php ++$dir = __DIR__ . '/'; ++$testfile = $dir . '001.phpt'; ++$zip = new ZipArchive(); ++$filename = $dir . '/gh19688.zip'; ++$zip->open($filename, ZipArchive::CREATE | ZipArchive::OVERWRITE); ++$options = array('remove_path' => $dir . 'a very long string here that will overrun'); ++$zip->addGlob($testfile, 0, $options); ++var_dump($zip->getNameIndex(0)); ++?> ++--CLEAN-- ++<?php ++@unlink(__DIR__ . '/gh19688.zip'); ++?> ++--EXPECTF-- ++string(%d) "%s001.phpt" +-- +2.51.0 + diff --git a/0003-regen-arginfo.patch b/0003-regen-arginfo.patch new file mode 100644 index 0000000..7325387 --- /dev/null +++ b/0003-regen-arginfo.patch @@ -0,0 +1,160 @@ +From 7b680397959dc27f08606056de489a4028784505 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 18 Sep 2025 11:21:24 +0200 +Subject: [PATCH 3/4] regen arginfo + +--- + php85/php_zip_arginfo.h | 91 +++++++++-------------------------------- + 1 file changed, 19 insertions(+), 72 deletions(-) + +diff --git a/php85/php_zip_arginfo.h b/php85/php_zip_arginfo.h +index c8dab41..2a24750 100644 +--- a/php85/php_zip_arginfo.h ++++ b/php85/php_zip_arginfo.h +@@ -465,113 +465,63 @@ static void register_php_zip_symbols(int module_number) + { + + zend_attribute *attribute_Deprecated_func_zip_open_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_open", sizeof("zip_open") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_open_0_arg0; +- zend_string *attribute_Deprecated_func_zip_open_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_open_0_arg0, attribute_Deprecated_func_zip_open_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_open_0->args[0].value, &attribute_Deprecated_func_zip_open_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_open_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_open_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_open_0_arg1; + zend_string *attribute_Deprecated_func_zip_open_0_arg1_str = zend_string_init("use ZipArchive::open() instead", strlen("use ZipArchive::open() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_open_0_arg1, attribute_Deprecated_func_zip_open_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_open_0->args[1].value, &attribute_Deprecated_func_zip_open_0_arg1); ++ ZVAL_STR(&attribute_Deprecated_func_zip_open_0->args[1].value, attribute_Deprecated_func_zip_open_0_arg1_str); + attribute_Deprecated_func_zip_open_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_attribute *attribute_Deprecated_func_zip_close_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_close", sizeof("zip_close") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_close_0_arg0; +- zend_string *attribute_Deprecated_func_zip_close_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_close_0_arg0, attribute_Deprecated_func_zip_close_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_close_0->args[0].value, &attribute_Deprecated_func_zip_close_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_close_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_close_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_close_0_arg1; + zend_string *attribute_Deprecated_func_zip_close_0_arg1_str = zend_string_init("use ZipArchive::close() instead", strlen("use ZipArchive::close() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_close_0_arg1, attribute_Deprecated_func_zip_close_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_close_0->args[1].value, &attribute_Deprecated_func_zip_close_0_arg1); ++ ZVAL_STR(&attribute_Deprecated_func_zip_close_0->args[1].value, attribute_Deprecated_func_zip_close_0_arg1_str); + attribute_Deprecated_func_zip_close_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_attribute *attribute_Deprecated_func_zip_read_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_read", sizeof("zip_read") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_read_0_arg0; +- zend_string *attribute_Deprecated_func_zip_read_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_read_0_arg0, attribute_Deprecated_func_zip_read_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_read_0->args[0].value, &attribute_Deprecated_func_zip_read_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_read_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_read_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_read_0_arg1; + zend_string *attribute_Deprecated_func_zip_read_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_read_0_arg1, attribute_Deprecated_func_zip_read_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_read_0->args[1].value, &attribute_Deprecated_func_zip_read_0_arg1); ++ ZVAL_STR(&attribute_Deprecated_func_zip_read_0->args[1].value, attribute_Deprecated_func_zip_read_0_arg1_str); + attribute_Deprecated_func_zip_read_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_attribute *attribute_Deprecated_func_zip_entry_open_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_open", sizeof("zip_entry_open") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 1); +- zval attribute_Deprecated_func_zip_entry_open_0_arg0; +- zend_string *attribute_Deprecated_func_zip_entry_open_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_open_0_arg0, attribute_Deprecated_func_zip_entry_open_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_open_0->args[0].value, &attribute_Deprecated_func_zip_entry_open_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_open_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_entry_open_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + + zend_attribute *attribute_Deprecated_func_zip_entry_close_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_close", sizeof("zip_entry_close") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 1); +- zval attribute_Deprecated_func_zip_entry_close_0_arg0; +- zend_string *attribute_Deprecated_func_zip_entry_close_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_close_0_arg0, attribute_Deprecated_func_zip_entry_close_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_close_0->args[0].value, &attribute_Deprecated_func_zip_entry_close_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_close_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_entry_close_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + + zend_attribute *attribute_Deprecated_func_zip_entry_read_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_read", sizeof("zip_entry_read") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_entry_read_0_arg0; +- zend_string *attribute_Deprecated_func_zip_entry_read_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_read_0_arg0, attribute_Deprecated_func_zip_entry_read_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_read_0->args[0].value, &attribute_Deprecated_func_zip_entry_read_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_read_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_entry_read_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_entry_read_0_arg1; + zend_string *attribute_Deprecated_func_zip_entry_read_0_arg1_str = zend_string_init("use ZipArchive::getFromIndex() instead", strlen("use ZipArchive::getFromIndex() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_read_0_arg1, attribute_Deprecated_func_zip_entry_read_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_read_0->args[1].value, &attribute_Deprecated_func_zip_entry_read_0_arg1); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_read_0->args[1].value, attribute_Deprecated_func_zip_entry_read_0_arg1_str); + attribute_Deprecated_func_zip_entry_read_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_attribute *attribute_Deprecated_func_zip_entry_name_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_name", sizeof("zip_entry_name") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_entry_name_0_arg0; +- zend_string *attribute_Deprecated_func_zip_entry_name_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_name_0_arg0, attribute_Deprecated_func_zip_entry_name_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_name_0->args[0].value, &attribute_Deprecated_func_zip_entry_name_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_name_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_entry_name_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_entry_name_0_arg1; +- zend_string *attribute_Deprecated_func_zip_entry_name_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_name_0_arg1, attribute_Deprecated_func_zip_entry_name_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_name_0->args[1].value, &attribute_Deprecated_func_zip_entry_name_0_arg1); ++ ZVAL_STR_COPY(&attribute_Deprecated_func_zip_entry_name_0->args[1].value, attribute_Deprecated_func_zip_read_0_arg1_str); + attribute_Deprecated_func_zip_entry_name_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_attribute *attribute_Deprecated_func_zip_entry_compressedsize_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_compressedsize", sizeof("zip_entry_compressedsize") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_entry_compressedsize_0_arg0; +- zend_string *attribute_Deprecated_func_zip_entry_compressedsize_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressedsize_0_arg0, attribute_Deprecated_func_zip_entry_compressedsize_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressedsize_0->args[0].value, &attribute_Deprecated_func_zip_entry_compressedsize_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressedsize_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_entry_compressedsize_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_entry_compressedsize_0_arg1; +- zend_string *attribute_Deprecated_func_zip_entry_compressedsize_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressedsize_0_arg1, attribute_Deprecated_func_zip_entry_compressedsize_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressedsize_0->args[1].value, &attribute_Deprecated_func_zip_entry_compressedsize_0_arg1); ++ ZVAL_STR_COPY(&attribute_Deprecated_func_zip_entry_compressedsize_0->args[1].value, attribute_Deprecated_func_zip_read_0_arg1_str); + attribute_Deprecated_func_zip_entry_compressedsize_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_attribute *attribute_Deprecated_func_zip_entry_filesize_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_filesize", sizeof("zip_entry_filesize") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_entry_filesize_0_arg0; +- zend_string *attribute_Deprecated_func_zip_entry_filesize_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_filesize_0_arg0, attribute_Deprecated_func_zip_entry_filesize_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_filesize_0->args[0].value, &attribute_Deprecated_func_zip_entry_filesize_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_filesize_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_entry_filesize_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_entry_filesize_0_arg1; +- zend_string *attribute_Deprecated_func_zip_entry_filesize_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_filesize_0_arg1, attribute_Deprecated_func_zip_entry_filesize_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_filesize_0->args[1].value, &attribute_Deprecated_func_zip_entry_filesize_0_arg1); ++ ZVAL_STR_COPY(&attribute_Deprecated_func_zip_entry_filesize_0->args[1].value, attribute_Deprecated_func_zip_read_0_arg1_str); + attribute_Deprecated_func_zip_entry_filesize_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + + zend_attribute *attribute_Deprecated_func_zip_entry_compressionmethod_0 = zend_add_function_attribute(zend_hash_str_find_ptr(CG(function_table), "zip_entry_compressionmethod", sizeof("zip_entry_compressionmethod") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); +- zval attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0; +- zend_string *attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0_str = zend_string_init("8.0", strlen("8.0"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0, attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressionmethod_0->args[0].value, &attribute_Deprecated_func_zip_entry_compressionmethod_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressionmethod_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_0)); + attribute_Deprecated_func_zip_entry_compressionmethod_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); +- zval attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1; +- zend_string *attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1_str = zend_string_init("use ZipArchive::statIndex() instead", strlen("use ZipArchive::statIndex() instead"), 1); +- ZVAL_STR(&attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1, attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_func_zip_entry_compressionmethod_0->args[1].value, &attribute_Deprecated_func_zip_entry_compressionmethod_0_arg1); ++ ZVAL_STR_COPY(&attribute_Deprecated_func_zip_entry_compressionmethod_0->args[1].value, attribute_Deprecated_func_zip_read_0_arg1_str); + attribute_Deprecated_func_zip_entry_compressionmethod_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + } + +@@ -1323,10 +1273,7 @@ static zend_class_entry *register_class_ZipArchive(zend_class_entry *class_entry + #if defined(ZIP_FL_RECOMPRESS) + + zend_attribute *attribute_Deprecated_const_FL_RECOMPRESS_0 = zend_add_class_constant_attribute(class_entry, const_FL_RECOMPRESS, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 1); +- zval attribute_Deprecated_const_FL_RECOMPRESS_0_arg0; +- zend_string *attribute_Deprecated_const_FL_RECOMPRESS_0_arg0_str = zend_string_init("8.3", strlen("8.3"), 1); +- ZVAL_STR(&attribute_Deprecated_const_FL_RECOMPRESS_0_arg0, attribute_Deprecated_const_FL_RECOMPRESS_0_arg0_str); +- ZVAL_COPY_VALUE(&attribute_Deprecated_const_FL_RECOMPRESS_0->args[0].value, &attribute_Deprecated_const_FL_RECOMPRESS_0_arg0); ++ ZVAL_STR(&attribute_Deprecated_const_FL_RECOMPRESS_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_3)); + attribute_Deprecated_const_FL_RECOMPRESS_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + #endif + +-- +2.51.0 + diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec index ba04bbe..b3fed8a 100644 --- a/php-pecl-zip.spec +++ b/php-pecl-zip.spec @@ -43,7 +43,7 @@ Summary: A ZIP archive management extension Name: %{?scl_prefix}php-pecl-zip Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}} -Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 5%{?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 @@ -53,6 +53,9 @@ Source0: https://pecl.php.net/get/%{sources}.tgz Patch0: 0001-8.5-compat.patch Patch1: 0001-fix-test-for-8.5.0beta2.patch Patch2: 0001-Fix-leak-when-path-is-too-long-in-ZipArchive-extract.patch +Patch3: 0001-Fix-memory-leak-in-zip-when-encountering-empty-glob-.patch +Patch4: 0002-Fix-GH-19688-Remove-pattern-overflow-in-zip-addGlob.patch +Patch5: 0003-regen-arginfo.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -121,6 +124,9 @@ cd %{sources} %patch -P0 -p1 %patch -P1 -p1 %patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 +%patch -P5 -p1 sed -e '/PHP_ZIP_VERSION/s/1.22.dev/%{version}/' -i php74/php_zip.h # Sanity check, really often broken @@ -246,6 +252,9 @@ TEST_PHP_EXECUTABLE=%{__ztsphp} \ %changelog +* Wed Sep 18 2025 Remi Collet <remi@remirepo.net> - 1.22.6-4 +- more upstream patches for PHP 8.5 + * Wed Jul 30 2025 Remi Collet <remi@remirepo.net> - 1.22.6-3 - rebuild for 8.5.0alpha3 |