From 8f469b9bd5254c294c2ed3d5e0dee27a1cf0cfce Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 16 Sep 2020 08:14:30 +0200 Subject: rebuild for 8.0.0beta4 --- php-pecl-zip.spec | 5 +- zip-php8.patch | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 173 insertions(+), 1 deletion(-) diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec index 1b63a47..e75314e 100644 --- a/php-pecl-zip.spec +++ b/php-pecl-zip.spec @@ -35,7 +35,7 @@ Summary: A ZIP archive management extension Summary(fr): Une extension de gestion des ZIP Name: %{?scl_prefix}php-pecl-zip Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}} -Release: 6%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 7%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP Group: Development/Languages URL: https://pecl.php.net/package/zip @@ -272,6 +272,9 @@ fi #### TODO: SCLs on EL-8 still use libzip from default stream (7.2 => 1.5.1) %changelog +* Wed Sep 16 2020 Remi Collet - 1.19.0-7 +- rebuild for 8.0.0beta4 + * Wed Sep 2 2020 Remi Collet - 1.19.0-6 - rebuild for 8.0.0beta3 diff --git a/zip-php8.patch b/zip-php8.patch index 83ad3bd..67834e3 100644 --- a/zip-php8.patch +++ b/zip-php8.patch @@ -1764,3 +1764,172 @@ index 43c2da9..c1a569a 100644 } /* }}} */ +From 6e93832682dc8d86540341f5c996d56798b6b691 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= +Date: Mon, 24 Aug 2020 20:42:29 +0200 +Subject: [PATCH] Move custom type checks to ZPP + +Closes GH-6034 +--- + php8/php_zip.c | 61 ++++++++++++++++++++---------------------- + php8/php_zip.stub.php | 7 ++--- + php8/php_zip_arginfo.h | 4 +-- + 3 files changed, 33 insertions(+), 39 deletions(-) + +diff --git a/php8/php_zip.c b/php8/php_zip.c +index c1a569a..6ebbc42 100644 +--- a/php8/php_zip.c ++++ b/php8/php_zip.c +@@ -2712,16 +2712,20 @@ PHP_METHOD(ZipArchive, extractTo) + struct zip *intern; + + zval *self = ZEND_THIS; +- zval *zval_files = NULL; ++ zend_string *files_str = NULL; ++ HashTable *files_ht = NULL; ++ + zval *zval_file = NULL; + php_stream_statbuf ssb; + char *pathto; + size_t pathto_len; + int ret; + +- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|z", &pathto, &pathto_len, &zval_files) == FAILURE) { +- RETURN_THROWS(); +- } ++ ZEND_PARSE_PARAMETERS_START(1, 2) ++ Z_PARAM_PATH(pathto, pathto_len) ++ Z_PARAM_OPTIONAL ++ Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(files_str, files_ht) ++ ZEND_PARSE_PARAMETERS_END(); + + ZIP_FROM_OBJECT(intern, self); + +@@ -2736,37 +2740,29 @@ PHP_METHOD(ZipArchive, extractTo) + } + } + +- if (zval_files && Z_TYPE_P(zval_files) != IS_NULL) { +- uint32_t nelems, i; ++ uint32_t nelems, i; + +- 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))) { +- RETURN_FALSE; +- } +- break; +- case IS_ARRAY: +- nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files)); +- if (nelems == 0 ) { +- RETURN_FALSE; +- } +- for (i = 0; i < nelems; i++) { +- if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(zval_files), i)) != NULL) { +- switch (Z_TYPE_P(zval_file)) { +- case IS_LONG: +- break; +- case IS_STRING: +- if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file))) { +- RETURN_FALSE; +- } +- break; ++ if (files_str) { ++ if (!php_zip_extract_file(intern, pathto, ZSTR_VAL(files_str), ZSTR_LEN(files_str))) { ++ RETURN_FALSE; ++ } ++ } else if (files_ht) { ++ nelems = zend_hash_num_elements(files_ht); ++ if (nelems == 0 ) { ++ RETURN_FALSE; ++ } ++ for (i = 0; i < nelems; i++) { ++ if ((zval_file = zend_hash_index_find(files_ht, i)) != NULL) { ++ switch (Z_TYPE_P(zval_file)) { ++ case IS_LONG: ++ break; ++ case IS_STRING: ++ if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file))) { ++ RETURN_FALSE; + } +- } ++ break; + } +- break; +- default: +- zend_argument_type_error(2, "must be of type array|string|null, %s given", zend_zval_type_name(zval_files)); +- RETURN_THROWS(); ++ } + } + } else { + /* Extract all files */ +@@ -2784,6 +2780,7 @@ PHP_METHOD(ZipArchive, extractTo) + } + } + } ++ + RETURN_TRUE; + } + /* }}} */ +diff --git a/php8/php_zip.stub.php b/php8/php_zip.stub.php +index 01f055f..cde2662 100644 +--- a/php8/php_zip.stub.php ++++ b/php8/php_zip.stub.php +@@ -161,11 +161,8 @@ public function unchangeIndex(int $index) {} + /** @return bool */ + public function unchangeName(string $name) {} + +- /** +- * @param array|string|null $files +- * @return bool +- */ +- public function extractTo(string $pathto, $files = null) {} ++ /** @return bool */ ++ public function extractTo(string $pathto, array|string|null $files = null) {} + + /** @return string|false */ + public function getFromName(string $entryname, int $len = 0, int $flags = 0) {} +diff --git a/php8/php_zip_arginfo.h b/php8/php_zip_arginfo.h +index 87222c9..c9f90d5 100644 +--- a/php8/php_zip_arginfo.h ++++ b/php8/php_zip_arginfo.h +@@ -1,5 +1,5 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: 880148896a71ad9bd076bb42c735ff1b83cd0731 */ ++ * Stub hash: 49f168c537e48f8a3998d67812a5e2e6a2463533 */ + + ZEND_BEGIN_ARG_INFO_EX(arginfo_zip_open, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) +@@ -175,7 +175,7 @@ ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_extractTo, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, pathto, IS_STRING, 0) +- ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, files, "null") ++ ZEND_ARG_TYPE_MASK(0, files, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_NULL, "null") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ZipArchive_getFromName, 0, 0, 1) +From 80a363601506de6e9038c8e794d0c797cd64b997 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= +Date: Fri, 11 Sep 2020 00:23:54 +0200 +Subject: [PATCH] Consolidate new union type ZPP macro names + +They will now follow the canonical order of types. Older macros are +left intact due to maintaining BC. +--- + php8/php_zip.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/php8/php_zip.c b/php8/php_zip.c +index 6ebbc42..96baaba 100644 +--- a/php8/php_zip.c ++++ b/php8/php_zip.c +@@ -2724,7 +2724,7 @@ PHP_METHOD(ZipArchive, extractTo) + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_PATH(pathto, pathto_len) + Z_PARAM_OPTIONAL +- Z_PARAM_STR_OR_ARRAY_HT_OR_NULL(files_str, files_ht) ++ Z_PARAM_ARRAY_HT_OR_STR_OR_NULL(files_ht, files_str) + ZEND_PARSE_PARAMETERS_END(); + + ZIP_FROM_OBJECT(intern, self); -- cgit