From 76c29a6f9357572496be9c62b2e70df3da90aabb Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 9 Sep 2021 13:41:23 +0200 Subject: improve patch for PHP 8.1 from https://github.com/php-gnupg/php-gnupg/pull/35 https://github.com/bukka/phpc/pull/3 --- 0001-Fix-iterator-prototypes-for-PHP-8.1.patch | 62 --------- gnupg-php81.patch | 166 +++++++++++++++++++++++++ php-pecl-gnupg.spec | 9 +- 3 files changed, 173 insertions(+), 64 deletions(-) delete mode 100644 0001-Fix-iterator-prototypes-for-PHP-8.1.patch create mode 100644 gnupg-php81.patch diff --git a/0001-Fix-iterator-prototypes-for-PHP-8.1.patch b/0001-Fix-iterator-prototypes-for-PHP-8.1.patch deleted file mode 100644 index f566a09..0000000 --- a/0001-Fix-iterator-prototypes-for-PHP-8.1.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0e35e0bbf81cdbb5346fcdc0a52e022b55075e58 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 9 Sep 2021 11:59:22 +0200 -Subject: [PATCH] Fix iterator prototypes for PHP 8.1 - ---- - gnupg_keylistiterator.c | 36 +++++++++++++++++++++++++++++++----- - 1 file changed, 31 insertions(+), 5 deletions(-) - -diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c -index 215aaa0..7390edd 100644 ---- a/gnupg_keylistiterator.c -+++ b/gnupg_keylistiterator.c -@@ -90,14 +90,40 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_void_iterator_method, 0, 0, 0) - ZEND_END_ARG_INFO() - /* }}} */ - -+#if PHP_VERSION_ID < 80100 -+ -+#define arginfo_gnupg_current arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_key arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_valid arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_next arginfo_gnupg_void_iterator_method -+#define arginfo_gnupg_rewind arginfo_gnupg_void_iterator_method -+ -+#else -+ -+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_current, 0, 0, IS_MIXED, 0) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_gnupg_key arginfo_gnupg_current -+ -+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_valid, 0, 0, _IS_BOOL, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_next, 0, 0, IS_VOID, 0) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_gnupg_rewind arginfo_gnupg_next -+ -+#endif -+ -+ - /* {{{ method list gnupg_keylistiterator */ - static zend_function_entry gnupg_keylistiterator_methods[] = { - PHP_ME(gnupg_keylistiterator, __construct, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, current, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, key, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, next, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, rewind, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -- PHP_ME(gnupg_keylistiterator, valid, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, current, arginfo_gnupg_current, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, key, arginfo_gnupg_key, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, next, arginfo_gnupg_next, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, rewind, arginfo_gnupg_rewind, ZEND_ACC_PUBLIC) -+ PHP_ME(gnupg_keylistiterator, valid, arginfo_gnupg_valid, ZEND_ACC_PUBLIC) - PHPC_FE_END - }; - /* }}} */ --- -2.31.1 - diff --git a/gnupg-php81.patch b/gnupg-php81.patch new file mode 100644 index 0000000..0ff0d12 --- /dev/null +++ b/gnupg-php81.patch @@ -0,0 +1,166 @@ +From 0e35e0bbf81cdbb5346fcdc0a52e022b55075e58 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 9 Sep 2021 11:59:22 +0200 +Subject: [PATCH 1/3] Fix iterator prototypes for PHP 8.1 + +--- + gnupg_keylistiterator.c | 36 +++++++++++++++++++++++++++++++----- + 1 file changed, 31 insertions(+), 5 deletions(-) + +diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c +index 215aaa0..7390edd 100644 +--- a/gnupg_keylistiterator.c ++++ b/gnupg_keylistiterator.c +@@ -90,14 +90,40 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_void_iterator_method, 0, 0, 0) + ZEND_END_ARG_INFO() + /* }}} */ + ++#if PHP_VERSION_ID < 80100 ++ ++#define arginfo_gnupg_current arginfo_gnupg_void_iterator_method ++#define arginfo_gnupg_key arginfo_gnupg_void_iterator_method ++#define arginfo_gnupg_valid arginfo_gnupg_void_iterator_method ++#define arginfo_gnupg_next arginfo_gnupg_void_iterator_method ++#define arginfo_gnupg_rewind arginfo_gnupg_void_iterator_method ++ ++#else ++ ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_current, 0, 0, IS_MIXED, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_gnupg_key arginfo_gnupg_current ++ ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_valid, 0, 0, _IS_BOOL, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_next, 0, 0, IS_VOID, 0) ++ZEND_END_ARG_INFO() ++ ++#define arginfo_gnupg_rewind arginfo_gnupg_next ++ ++#endif ++ ++ + /* {{{ method list gnupg_keylistiterator */ + static zend_function_entry gnupg_keylistiterator_methods[] = { + PHP_ME(gnupg_keylistiterator, __construct, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) +- PHP_ME(gnupg_keylistiterator, current, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) +- PHP_ME(gnupg_keylistiterator, key, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) +- PHP_ME(gnupg_keylistiterator, next, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) +- PHP_ME(gnupg_keylistiterator, rewind, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) +- PHP_ME(gnupg_keylistiterator, valid, arginfo_gnupg_void_iterator_method, ZEND_ACC_PUBLIC) ++ PHP_ME(gnupg_keylistiterator, current, arginfo_gnupg_current, ZEND_ACC_PUBLIC) ++ PHP_ME(gnupg_keylistiterator, key, arginfo_gnupg_key, ZEND_ACC_PUBLIC) ++ PHP_ME(gnupg_keylistiterator, next, arginfo_gnupg_next, ZEND_ACC_PUBLIC) ++ PHP_ME(gnupg_keylistiterator, rewind, arginfo_gnupg_rewind, ZEND_ACC_PUBLIC) ++ PHP_ME(gnupg_keylistiterator, valid, arginfo_gnupg_valid, ZEND_ACC_PUBLIC) + PHPC_FE_END + }; + /* }}} */ +-- +2.31.1 + +From 512acab50beb1b375ef5621b27e1466efb010e58 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 9 Sep 2021 12:46:48 +0200 +Subject: [PATCH 2/3] Simplify previous + +--- + gnupg_keylistiterator.c | 15 ++++----------- + 1 file changed, 4 insertions(+), 11 deletions(-) + +diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c +index 7390edd..4d3c074 100644 +--- a/gnupg_keylistiterator.c ++++ b/gnupg_keylistiterator.c +@@ -90,15 +90,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_void_iterator_method, 0, 0, 0) + ZEND_END_ARG_INFO() + /* }}} */ + +-#if PHP_VERSION_ID < 80100 +- +-#define arginfo_gnupg_current arginfo_gnupg_void_iterator_method +-#define arginfo_gnupg_key arginfo_gnupg_void_iterator_method +-#define arginfo_gnupg_valid arginfo_gnupg_void_iterator_method +-#define arginfo_gnupg_next arginfo_gnupg_void_iterator_method +-#define arginfo_gnupg_rewind arginfo_gnupg_void_iterator_method +- +-#else ++#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX ++#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ ++ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) ++#endif + + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_current, 0, 0, IS_MIXED, 0) + ZEND_END_ARG_INFO() +@@ -113,8 +108,6 @@ ZEND_END_ARG_INFO() + + #define arginfo_gnupg_rewind arginfo_gnupg_next + +-#endif +- + + /* {{{ method list gnupg_keylistiterator */ + static zend_function_entry gnupg_keylistiterator_methods[] = { +-- +2.31.1 + +From 6ebd34017e920c6e25878ba43d77d08c426f804e Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 9 Sep 2021 13:36:44 +0200 +Subject: [PATCH 3/3] use ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX + from phpc + +--- + gnupg_keylistiterator.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/gnupg_keylistiterator.c b/gnupg_keylistiterator.c +index 4d3c074..9b285ee 100644 +--- a/gnupg_keylistiterator.c ++++ b/gnupg_keylistiterator.c +@@ -90,11 +90,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_gnupg_void_iterator_method, 0, 0, 0) + ZEND_END_ARG_INFO() + /* }}} */ + +-#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX +-#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ +- ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) +-#endif +- + ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_gnupg_current, 0, 0, IS_MIXED, 0) + ZEND_END_ARG_INFO() + +-- +2.31.1 + +From e9e2769c852ac5d6755245387755c589379a1e1c Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 9 Sep 2021 13:34:59 +0200 +Subject: [PATCH] define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX for + php < 8.1 + +--- + phpc.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/phpc.h b/phpc.h +index 4b55747..70fb317 100644 +--- a/phpc/phpc.h ++++ b/phpc/phpc.h +@@ -51,6 +51,12 @@ + memcpy(&PHPC_OBJ_GET_HANDLER_VAR_NAME(_name), \ + zend_get_std_object_handlers(), sizeof(zend_object_handlers)) + ++/* for arginfo */ ++#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX ++#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ ++ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) ++#endif ++ + /* ZEND_ACC_CTOR and ZEND_ACC_DTOR is removed in 7.4 */ + #ifndef ZEND_ACC_CTOR + #define ZEND_ACC_CTOR 0 +-- +2.31.1 + diff --git a/php-pecl-gnupg.spec b/php-pecl-gnupg.spec index 2db4bbf..8db5d5e 100644 --- a/php-pecl-gnupg.spec +++ b/php-pecl-gnupg.spec @@ -25,13 +25,13 @@ Summary: Wrapper around the gpgme library Name: %{?sub_prefix}php-pecl-gnupg Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: BSD URL: https://pecl.php.net/package/gnupg Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz -Patch0: 0001-Fix-iterator-prototypes-for-PHP-8.1.patch +Patch0: %{pecl_name}-php81.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -242,6 +242,11 @@ cd ../ZTS %changelog +* Thu Sep 9 2021 Remi Collet - 1.5.0-3 +- improve patch for PHP 8.1 from + https://github.com/php-gnupg/php-gnupg/pull/35 + https://github.com/bukka/phpc/pull/3 + * Thu Sep 9 2021 Remi Collet - 1.5.0-2 - add patch for PHP 8.1 from https://github.com/php-gnupg/php-gnupg/pull/35 -- cgit