1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 < 70200
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 < 70200
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;
|