diff options
author | Remi Collet <remi@remirepo.net> | 2021-09-10 15:03:36 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2021-09-10 15:03:36 +0200 |
commit | 9e21b6e42274425900db59f748f1721b884cf297 (patch) | |
tree | b86abf382cb19766461c181823032e622eaffe8e | |
parent | 1c2ec694de8ac98ec1d8971c119b371ed687ebd0 (diff) |
add fix for PHP 8.1 from upstream and from
https://github.com/arnaud-lb/php-rdkafka/pull/467
-rw-r--r-- | php-pecl-rdkafka5.spec | 13 | ||||
-rw-r--r-- | rdkafka-php81.patch | 113 |
2 files changed, 125 insertions, 1 deletions
diff --git a/php-pecl-rdkafka5.spec b/php-pecl-rdkafka5.spec index 2239007..f161bfb 100644 --- a/php-pecl-rdkafka5.spec +++ b/php-pecl-rdkafka5.spec @@ -21,11 +21,13 @@ Summary: Kafka client based on librdkafka Name: %{?sub_prefix}php-pecl-%{pecl_name}5 Version: 5.0.0 -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: MIT URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: %{pecl_name}-php81.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: librdkafka1php-devel >= 1.6 @@ -70,6 +72,9 @@ Obsoletes: php74-pecl-%{pecl_name} <= %{version} %if "%{php_version}" > "8.0" Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.1" +Obsoletes: php81-pecl-%{pecl_name} <= %{version} +%endif %endif @@ -89,6 +94,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_RDKAFKA_VERSION/{s/.* "//;s/".*$//;p}' php_rdkafka.h) if test "x${extver}" != "x%{version}"; then @@ -203,6 +210,10 @@ cd ../ZTS %changelog +* Fri Sep 10 2021 Remi Collet <remi@remirepo.net> - 5.0.0-3 +- add fix for PHP 8.1 from upstream and from + https://github.com/arnaud-lb/php-rdkafka/pull/467 + * Wed Jan 27 2021 Remi Collet <remi@remirepo.net> - 5.0.0-2 - rebuild with librdkafka version 1.6.0 diff --git a/rdkafka-php81.patch b/rdkafka-php81.patch new file mode 100644 index 0000000..18c2329 --- /dev/null +++ b/rdkafka-php81.patch @@ -0,0 +1,113 @@ +From b3bfa61ef33285b82e785e8f8b0946801ebcce84 Mon Sep 17 00:00:00 2001 +From: Nick <nickjobszh@gmail.com> +Date: Fri, 2 Jul 2021 11:40:44 +0200 +Subject: [PATCH] replace deprecated interfaces (#460) + +* replace deprecated interfaces + +* fix for 7.0 +--- + metadata_collection.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/metadata_collection.c b/metadata_collection.c +index af986ff..2d273f6 100644 +--- a/metadata_collection.c ++++ b/metadata_collection.c +@@ -275,7 +275,11 @@ void kafka_metadata_collection_minit(INIT_FUNC_ARGS) + INIT_NS_CLASS_ENTRY(tmpce, "RdKafka\\Metadata", "Collection", fe); + ce = zend_register_internal_class(&tmpce); + ce->create_object = create_object; ++#if PHP_VERSION_ID < 80100 + zend_class_implements(ce, 2, spl_ce_Countable, spl_ce_Iterator); ++#else ++ zend_class_implements(ce, 2, zend_ce_countable, zend_ce_iterator); ++#endif + + handlers = kafka_default_object_handlers; + handlers.get_debug_info = get_debug_info; +From e570ef17571f22ec973094904e0854a1871bc4d1 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 10 Sep 2021 14:56:16 +0200 +Subject: [PATCH] fix iterator prototype for PHP 8.1 + +--- + metadata_collection.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/metadata_collection.c b/metadata_collection.c +index 2d273f6..95a9210 100644 +--- a/metadata_collection.c ++++ b/metadata_collection.c +@@ -113,7 +113,11 @@ static HashTable *get_debug_info(Z_RDKAFKA_OBJ *object, int *is_temp) /* {{{ */ + /* {{{ proto int RdKafka\Metadata\Collection::count() + */ + ++#if PHP_VERSION_ID < 80100 + ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_metadata_count, 0, 0, 0) ++#else ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_kafka_metadata_count, 0, 0, IS_LONG, 0) ++#endif + ZEND_END_ARG_INFO() + + PHP_METHOD(RdKafka__Metadata__Collection, count) +@@ -136,7 +140,11 @@ PHP_METHOD(RdKafka__Metadata__Collection, count) + /* {{{ proto void RdKafka\Metadata\Collection::rewind() + */ + ++#if PHP_VERSION_ID < 80100 + ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_metadata_rewind, 0, 0, 0) ++#else ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_kafka_metadata_rewind, 0, 0, IS_VOID, 0) ++#endif + ZEND_END_ARG_INFO() + + PHP_METHOD(RdKafka__Metadata__Collection, rewind) +@@ -159,7 +167,11 @@ PHP_METHOD(RdKafka__Metadata__Collection, rewind) + /* {{{ proto mixed RdKafka\Metadata\Collection::current() + */ + ++#if PHP_VERSION_ID < 80100 + ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_metadata_current, 0, 0, 0) ++#else ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_kafka_metadata_current, 0, 0, IS_MIXED, 0) ++#endif + ZEND_END_ARG_INFO() + + PHP_METHOD(RdKafka__Metadata__Collection, current) +@@ -187,7 +199,11 @@ PHP_METHOD(RdKafka__Metadata__Collection, current) + /* {{{ proto mixed RdKafka\Metadata\Collection::key() + */ + ++#if PHP_VERSION_ID < 80100 + ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_metadata_key, 0, 0, 0) ++#else ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_kafka_metadata_key, 0, 0, IS_MIXED, 0) ++#endif + ZEND_END_ARG_INFO() + + PHP_METHOD(RdKafka__Metadata__Collection, key) +@@ -215,7 +231,11 @@ PHP_METHOD(RdKafka__Metadata__Collection, key) + /* {{{ proto void RdKafka\Metadata\Collection::next() + */ + ++#if PHP_VERSION_ID < 80100 + ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_metadata_next, 0, 0, 0) ++#else ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_kafka_metadata_next, 0, 0, IS_VOID, 0) ++#endif + ZEND_END_ARG_INFO() + + PHP_METHOD(RdKafka__Metadata__Collection, next) +@@ -238,7 +258,11 @@ PHP_METHOD(RdKafka__Metadata__Collection, next) + /* {{{ proto bool RdKafka\Metadata\Collection::valid() + */ + ++#if PHP_VERSION_ID < 80100 + ZEND_BEGIN_ARG_INFO_EX(arginfo_kafka_metadata_valid, 0, 0, 0) ++#else ++ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_kafka_metadata_valid, 0, 0, _IS_BOOL, 0) ++#endif + ZEND_END_ARG_INFO() + + PHP_METHOD(RdKafka__Metadata__Collection, valid) |