From ea08661243802488eca21f45afdee164298069f7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 11 May 2022 14:18:55 +0200 Subject: add upstream patch for PHP 8.2 --- 0001-support-8.2.patch | 120 +++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-zip.spec | 9 +++- 2 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 0001-support-8.2.patch diff --git a/0001-support-8.2.patch b/0001-support-8.2.patch new file mode 100644 index 0000000..dd3f061 --- /dev/null +++ b/0001-support-8.2.patch @@ -0,0 +1,120 @@ +From 7afdbe2fc07b0e862b6e79190f9ff7f1ff3f61f9 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 11 May 2022 14:02:38 +0200 +Subject: [PATCH] support 8.2 + +--- + config.m4 | 4 ++-- + config.w32 | 2 ++ + php81/php_zip.c | 4 ++++ + tests/bug53603.phpt | 1 + + tests/bug53885_php8.phpt | 2 +- + tests/bug70752.phpt | 2 +- + tests/oo_getstatusstring.phpt | 4 ++-- + 7 files changed, 13 insertions(+), 6 deletions(-) + +diff --git a/config.m4 b/config.m4 +index 3737db2..390108b 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 80200; then +- AC_MSG_RESULT(8.1) ++ elif test $PHP_VERSION -lt 80300; then ++ AC_MSG_RESULT(8.1/8.2) + subdir=php81 + else + AC_MSG_ERROR(PHP version $PHP_VERSION is not supported yet) +diff --git a/config.w32 b/config.w32 +index 2d45fb6..1d1c3e0 100644 +--- a/config.w32 ++++ b/config.w32 +@@ -30,6 +30,8 @@ if (PHP_ZIP != "no") { + configure_module_dirname = configure_module_dirname + "\\php8"; + } else if (PHP_VERSION == 8 && PHP_MINOR_VERSION == 1) { + configure_module_dirname = configure_module_dirname + "\\php81"; ++ } else if (PHP_VERSION == 8 && PHP_MINOR_VERSION == 2) { ++ configure_module_dirname = configure_module_dirname + "\\php81"; + } else { + ERROR("PHP " + PHP_VERSION + "." + PHP_MINOR_VERSION + " not supported"); + } +diff --git a/php81/php_zip.c b/php81/php_zip.c +index ca040b5..9be5a9b 100644 +--- a/php81/php_zip.c ++++ b/php81/php_zip.c +@@ -993,7 +993,11 @@ static HashTable *php_zip_get_properties(zend_object *object)/* {{{ */ + return NULL; + } + ++#if PHP_VERSION_ID < 80200 + ZEND_HASH_FOREACH_STR_KEY_PTR(obj->prop_handler, key, hnd) { ++#else ++ ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(obj->prop_handler, key, hnd) { ++#endif + zval *ret, val; + ret = php_zip_property_reader(obj, hnd, &val); + if (ret == NULL) { +diff --git a/tests/bug53603.phpt b/tests/bug53603.phpt +index b1058b0..76b8ad9 100644 +--- a/tests/bug53603.phpt ++++ b/tests/bug53603.phpt +@@ -8,6 +8,7 @@ if(!extension_loaded('zip')) die('skip'); + statName("a",ZIPARCHIVE::FL_UNCHANGED); + --CLEAN-- + + --EXPECTF-- + Deprecated: ZipArchive::open(): Using empty file as ZipArchive is deprecated in %s +diff --git a/tests/bug70752.phpt b/tests/bug70752.phpt +index f006fbe..46546b5 100644 +--- a/tests/bug70752.phpt ++++ b/tests/bug70752.phpt +@@ -27,5 +27,5 @@ bool(false) + --CLEAN-- + +diff --git a/tests/oo_getstatusstring.phpt b/tests/oo_getstatusstring.phpt +index efd19e3..5860b64 100644 +--- a/tests/oo_getstatusstring.phpt ++++ b/tests/oo_getstatusstring.phpt +@@ -8,7 +8,7 @@ Ole-Petter Wikene + --FILE-- + open($dirname.'foo.zip',ZIPARCHIVE::CREATE); + var_dump($arch->getStatusString()); +@@ -20,7 +20,7 @@ $arch->close(); + ?> + --CLEAN-- + + --EXPECT-- + string(8) "No error" +-- +2.35.3 + diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec index 446d07b..60ef394 100644 --- a/php-pecl-zip.spec +++ b/php-pecl-zip.spec @@ -34,13 +34,15 @@ 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 Group: Development/Languages URL: https://pecl.php.net/package/zip Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Patch0: 0001-support-8.2.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -144,6 +146,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -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 @@ -281,6 +285,9 @@ fi %changelog +* Wed May 11 2022 Remi Collet - 1.20.1-2 +- add upstream patch for PHP 8.2 + * Mon May 2 2022 Remi Collet - 1.20.1-1 - update to 1.20.1 -- cgit