From cc284ad08eff3a8f80e65159aab779505716ab37 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 8 Jun 2021 17:52:44 +0200 Subject: update to 3.17.3 add patch for PHP 8.1 from https://github.com/protocolbuffers/protobuf/pull/8710 --- PHPINFO | 2 +- REFLECTION | 2 +- php-pecl-protobuf.spec | 14 +++++++++++++- protobuf-php81.patch | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 protobuf-php81.patch diff --git a/PHPINFO b/PHPINFO index 8e90dbc..9226357 100644 --- a/PHPINFO +++ b/PHPINFO @@ -1,7 +1,7 @@ protobuf -Version => 3.17.2 +Version => 3.17.3 Directive => Local Value => Master Value protobuf.keep_descriptor_pool_after_request => 0 => 0 diff --git a/REFLECTION b/REFLECTION index 58563e9..faaf099 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #118 protobuf version 3.17.2 ] { +Extension [ extension #119 protobuf version 3.17.3 ] { - Dependencies { Dependency [ date (Optional) ] diff --git a/php-pecl-protobuf.spec b/php-pecl-protobuf.spec index 31cf593..40fcd54 100644 --- a/php-pecl-protobuf.spec +++ b/php-pecl-protobuf.spec @@ -18,7 +18,7 @@ %global pecl_name protobuf %global with_zts 0 %global ini_name 40-%{pecl_name}.ini -%global upstream_version 3.17.2 +%global upstream_version 3.17.3 #global upstream_prever RC2 Summary: Mechanism for serializing structured data @@ -29,6 +29,8 @@ License: BSD URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Patch0: %{pecl_name}-php81.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.0 @@ -58,6 +60,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 @@ -82,6 +87,8 @@ sed -e 's/role="test"/role="src"/' \ cd NTS +%patch0 -p5 -b .php81 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_PROTOBUF_VERSION/{s/.* "//;s/".*$//;p}' protobuf.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -201,6 +208,11 @@ fi %changelog +* Tue Jun 8 2021 Remi Collet - 3.17.3-1 +- update to 3.17.3 +- add patch for PHP 8.1 from + https://github.com/protocolbuffers/protobuf/pull/8710 + * Thu Jun 3 2021 Remi Collet - 3.17.2-1 - update to 3.17.2 (no change) diff --git a/protobuf-php81.patch b/protobuf-php81.patch new file mode 100644 index 0000000..716d33d --- /dev/null +++ b/protobuf-php81.patch @@ -0,0 +1,46 @@ +From bba29c038869a2ce890d43d3d33d002fff572e82 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 8 Jun 2021 17:36:45 +0200 +Subject: [PATCH] fix for PHP 8.1 + +--- + php/ext/google/protobuf/array.c | 5 +++++ + php/ext/google/protobuf/map.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/php/ext/google/protobuf/array.c b/php/ext/google/protobuf/array.c +index 765e90297c..7060f7ed91 100644 +--- a/php/ext/google/protobuf/array.c ++++ b/php/ext/google/protobuf/array.c +@@ -640,8 +640,13 @@ void Array_ModuleInit() { + repeated_field_methods); + + RepeatedField_class_entry = zend_register_internal_class(&tmp_ce); ++#if PHP_VERSION_ID < 80100 + zend_class_implements(RepeatedField_class_entry, 3, spl_ce_ArrayAccess, + zend_ce_aggregate, spl_ce_Countable); ++#else ++ zend_class_implements(RepeatedField_class_entry, 3, zend_ce_arrayaccess, ++ zend_ce_aggregate, zend_ce_countable); ++#endif + RepeatedField_class_entry->ce_flags |= ZEND_ACC_FINAL; + RepeatedField_class_entry->create_object = RepeatedField_create; + +diff --git a/php/ext/google/protobuf/map.c b/php/ext/google/protobuf/map.c +index f5890d99e4..158d0bfd51 100644 +--- a/php/ext/google/protobuf/map.c ++++ b/php/ext/google/protobuf/map.c +@@ -636,8 +636,13 @@ void Map_ModuleInit() { + MapField_methods); + + MapField_class_entry = zend_register_internal_class(&tmp_ce); ++#if PHP_VERSION_ID < 80000 + zend_class_implements(MapField_class_entry, 3, spl_ce_ArrayAccess, + zend_ce_aggregate, spl_ce_Countable); ++#else ++ zend_class_implements(MapField_class_entry, 3, zend_ce_arrayaccess, ++ zend_ce_aggregate, zend_ce_countable); ++#endif + MapField_class_entry->ce_flags |= ZEND_ACC_FINAL; + MapField_class_entry->create_object = MapField_create; + -- cgit