summaryrefslogtreecommitdiffstats
path: root/15dc0f40438599f20303dbcec77bce010af88270.patch
diff options
context:
space:
mode:
Diffstat (limited to '15dc0f40438599f20303dbcec77bce010af88270.patch')
-rw-r--r--15dc0f40438599f20303dbcec77bce010af88270.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/15dc0f40438599f20303dbcec77bce010af88270.patch b/15dc0f40438599f20303dbcec77bce010af88270.patch
new file mode 100644
index 0000000..e200ba4
--- /dev/null
+++ b/15dc0f40438599f20303dbcec77bce010af88270.patch
@@ -0,0 +1,65 @@
+From 15dc0f40438599f20303dbcec77bce010af88270 Mon Sep 17 00:00:00 2001
+From: Bo Yang <teboring@google.com>
+Date: Sun, 1 Dec 2019 16:43:29 +0000
+Subject: [PATCH] Make c extension portable for php 7.4
+
+---
+ php/ext/google/protobuf/protobuf.h | 19 +++++++-------
+ php/ext/google/protobuf/storage.c | 4 ++-
+ tests.sh | 42 ++++++++++++++++++++++++++++++
+ 3 files changed, 54 insertions(+), 11 deletions(-)
+
+diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
+index 059ee55fa1..ee3620def5 100644
+--- a/php/ext/google/protobuf/protobuf.h
++++ b/php/ext/google/protobuf/protobuf.h
+@@ -410,15 +410,14 @@ static inline int php_proto_zend_hash_get_current_data_ex(HashTable* ht,
+ zend_object std; \
+ };
+
+-#define PHP_PROTO_INIT_SUBMSGCLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
+- void LOWWERNAME##_init(TSRMLS_D) { \
+- zend_class_entry class_type; \
+- const char* class_name = CLASSNAME; \
+- INIT_CLASS_ENTRY_EX(class_type, CLASSNAME, strlen(CLASSNAME), \
+- LOWWERNAME##_methods); \
+- LOWWERNAME##_type = zend_register_internal_class_ex( \
+- &class_type, message_type TSRMLS_CC); \
+- zend_do_inheritance(LOWWERNAME##_type, message_type TSRMLS_CC);
++#define PHP_PROTO_INIT_SUBMSGCLASS_START(CLASSNAME, CAMELNAME, LOWWERNAME) \
++ void LOWWERNAME##_init(TSRMLS_D) { \
++ zend_class_entry class_type; \
++ const char* class_name = CLASSNAME; \
++ INIT_CLASS_ENTRY_EX(class_type, CLASSNAME, strlen(CLASSNAME), \
++ LOWWERNAME##_methods); \
++ LOWWERNAME##_type = zend_register_internal_class(&class_type); \
++ zend_do_inheritance(LOWWERNAME##_type, message_type);
+ #define PHP_PROTO_INIT_SUBMSGCLASS_END \
+ }
+
+@@ -428,7 +427,7 @@ static inline int php_proto_zend_hash_get_current_data_ex(HashTable* ht,
+ const char* class_name = CLASSNAME; \
+ INIT_CLASS_ENTRY_EX(class_type, CLASSNAME, strlen(CLASSNAME), \
+ LOWWERNAME##_methods); \
+- LOWWERNAME##_type = zend_register_internal_class(&class_type TSRMLS_CC);
++ LOWWERNAME##_type = zend_register_internal_class(&class_type);
+ #define PHP_PROTO_INIT_ENUMCLASS_END \
+ }
+
+diff --git a/php/ext/google/protobuf/storage.c b/php/ext/google/protobuf/storage.c
+index 235c5df8a8..f96dfd0e09 100644
+--- a/php/ext/google/protobuf/storage.c
++++ b/php/ext/google/protobuf/storage.c
+@@ -100,8 +100,10 @@ bool native_slot_set(upb_fieldtype_t type, const zend_class_entry* klass,
+ if (EXPECTED(cached_zval != NULL)) {
+ #if PHP_MAJOR_VERSION < 7
+ REPLACE_ZVAL_VALUE((zval**)memory, value, 1);
+-#else
++#elif PHP_VERSION_ID < 70400
+ zend_assign_to_variable(cached_zval, value, IS_CV);
++#else
++ zend_assign_to_variable(cached_zval, value, IS_CV, 0);
+ #endif
+ }
+ break;
+