summaryrefslogtreecommitdiffstats
path: root/protobuf-php81.patch
diff options
context:
space:
mode:
Diffstat (limited to 'protobuf-php81.patch')
-rw-r--r--protobuf-php81.patch46
1 files changed, 46 insertions, 0 deletions
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 <remi@remirepo.net>
+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;
+