From c25d51db75c5e8cb6f48bdf53f2940101bf4f03a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 14 Dec 2019 07:22:18 +0100 Subject: v3.11.2 --- 15dc0f40438599f20303dbcec77bce010af88270.patch | 65 ----------- 5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch | 143 ------------------------- PHPINFO | 2 +- REFLECTION | 2 +- php-pecl-protobuf.spec | 11 +- 5 files changed, 6 insertions(+), 217 deletions(-) delete mode 100644 15dc0f40438599f20303dbcec77bce010af88270.patch delete mode 100644 5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch diff --git a/15dc0f40438599f20303dbcec77bce010af88270.patch b/15dc0f40438599f20303dbcec77bce010af88270.patch deleted file mode 100644 index e200ba4..0000000 --- a/15dc0f40438599f20303dbcec77bce010af88270.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 15dc0f40438599f20303dbcec77bce010af88270 Mon Sep 17 00:00:00 2001 -From: Bo Yang -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; - diff --git a/5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch b/5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch deleted file mode 100644 index 04b10d7..0000000 --- a/5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 5b075fd0afe0e3df78ba12edb4074ccd5c131984 Mon Sep 17 00:00:00 2001 -From: Bo Yang -Date: Tue, 3 Dec 2019 02:17:50 +0000 -Subject: [PATCH] Fix comments - ---- - php/ext/google/protobuf/message.c | 21 ++++++++++++++++++++- - php/ext/google/protobuf/type_check.c | 24 ++++++++++++++++++++++-- - 2 files changed, 42 insertions(+), 3 deletions(-) - -diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c -index 9adf3b0179..7f6947c2ca 100644 ---- a/php/ext/google/protobuf/message.c -+++ b/php/ext/google/protobuf/message.c -@@ -75,8 +75,13 @@ static zval** message_get_property_ptr_ptr(zval* object, zval* member, int type, - php_proto_zend_literal key TSRMLS_DC); - static HashTable* message_get_gc(zval* object, zval*** table, int* n TSRMLS_DC); - #else -+#if PHP_VERSION_ID < 70400 - static void message_set_property(zval* object, zval* member, zval* value, - void** cache_slot); -+#else -+static zval* message_set_property(zval* object, zval* member, zval* value, -+ void** cache_slot); -+#endif - static zval* message_get_property(zval* object, zval* member, int type, - void** cache_slot, zval* rv); - static zval* message_get_property_ptr_ptr(zval* object, zval* member, int type, -@@ -140,13 +145,20 @@ static void message_set_property_internal(zval* object, zval* member, - #if PHP_MAJOR_VERSION < 7 - static void message_set_property(zval* object, zval* member, zval* value, - php_proto_zend_literal key TSRMLS_DC) { --#else -+#elif PHP_VERSION_ID < 70400 - static void message_set_property(zval* object, zval* member, zval* value, - void** cache_slot) { -+#else -+static zval* message_set_property(zval* object, zval* member, zval* value, -+ void** cache_slot) { - #endif - if (Z_TYPE_P(member) != IS_STRING) { - zend_error(E_USER_ERROR, "Unexpected type for field name"); -+#if PHP_VERSION_ID < 70400 - return; -+#else -+ return value; -+#endif - } - - #if PHP_MAJOR_VERSION < 7 || (PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION == 0) -@@ -156,10 +168,17 @@ static void message_set_property(zval* object, zval* member, zval* value, - #endif - // User cannot set property directly (e.g., $m->a = 1) - zend_error(E_USER_ERROR, "Cannot access private property."); -+#if PHP_VERSION_ID < 70400 - return; -+#else -+ return value; -+#endif - } - - message_set_property_internal(object, member, value TSRMLS_CC); -+#if PHP_VERSION_ID >= 70400 -+ return value; -+#endif - } - - static zval* message_get_property_internal(zval* object, -diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c -index af35b90318..84d06be7ef 100644 ---- a/php/ext/google/protobuf/type_check.c -+++ b/php/ext/google/protobuf/type_check.c -@@ -407,8 +407,6 @@ bool protobuf_convert_to_bool(zval* from, int8_t* to) { - *to = (int8_t)(Z_LVAL_P(from) != 0); - break; - case IS_STRING: { -- char* strval = Z_STRVAL_P(from); -- - if (Z_STRLEN_P(from) == 0 || - (Z_STRLEN_P(from) == 1 && Z_STRVAL_P(from)[0] == '0')) { - *to = 0; -@@ -496,7 +494,11 @@ PHP_METHOD(Util, checkMessage) { - if (!instanceof_function(Z_OBJCE_P(val), klass TSRMLS_CC)) { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, - "Given value is not an instance of %s.", -+#if PHP_MAJOR_VERSION < 7 - klass->name); -+#else -+ ZSTR_VAL(klass->name)); -+#endif - return; - } - RETURN_ZVAL(val, 1, 0); -@@ -541,7 +543,11 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type, - if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, - "Given value is not an instance of %s.", -+#if PHP_MAJOR_VERSION < 7 - repeated_field_type->name); -+#else -+ ZSTR_VAL(repeated_field_type->name)); -+#endif - return; - } - RepeatedField* intern = UNBOX(RepeatedField, val); -@@ -553,7 +559,12 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type, - if (klass != NULL && intern->msg_ce != klass) { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, - "Expect a repeated field of %s, but %s is given.", -+#if PHP_MAJOR_VERSION < 7 - klass->name, intern->msg_ce->name); -+#else -+ ZSTR_VAL(klass->name), -+ ZSTR_VAL(intern->msg_ce->name)); -+#endif - return; - } - RETURN_ZVAL(val, 1, 0); -@@ -617,7 +628,11 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type, - if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, - "Given value is not an instance of %s.", -+#if PHP_MAJOR_VERSION < 7 - map_field_type->name); -+#else -+ ZSTR_VAL(map_field_type->name)); -+#endif - return; - } - Map* intern = UNBOX(Map, val); -@@ -636,7 +651,12 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type, - if (klass != NULL && intern->msg_ce != klass) { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, - "Expect a map field of %s, but %s is given.", -+#if PHP_MAJOR_VERSION < 7 - klass->name, intern->msg_ce->name); -+#else -+ ZSTR_VAL(klass->name), -+ ZSTR_VAL(intern->msg_ce->name)); -+#endif - return; - } - RETURN_ZVAL(val, 1, 0); diff --git a/PHPINFO b/PHPINFO index c206f9a..8daf62c 100644 --- a/PHPINFO +++ b/PHPINFO @@ -1,7 +1,7 @@ protobuf -Version => 3.11.1 +Version => 3.11.2 Directive => Local Value => Master Value protobuf.keep_descriptor_pool_after_request => 0 => 0 diff --git a/REFLECTION b/REFLECTION index 054c0f5..84bd215 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #129 protobuf version 3.11.1 ] { +Extension [ extension #105 protobuf version 3.11.2 ] { - Dependencies { Dependency [ date (Optional) ] diff --git a/php-pecl-protobuf.spec b/php-pecl-protobuf.spec index b761033..512cd1a 100644 --- a/php-pecl-protobuf.spec +++ b/php-pecl-protobuf.spec @@ -22,7 +22,7 @@ %else %global ini_name 40-%{pecl_name}.ini %endif -%global upstream_version 3.11.1 +%global upstream_version 3.11.2 #global upstream_prever RC2 Summary: Mechanism for serializing structured data @@ -33,9 +33,6 @@ License: BSD URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz -Patch0: https://github.com/TeBoring/protobuf/commit/15dc0f40438599f20303dbcec77bce010af88270.patch -Patch1: https://github.com/protocolbuffers/protobuf/commit/5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch - BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 5.5.9 BuildRequires: %{?scl_prefix}php-pear @@ -101,9 +98,6 @@ sed -e 's/role="test"/role="src"/' \ cd NTS -%patch0 -p5 -%patch1 -p5 - # 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 @@ -223,6 +217,9 @@ fi %changelog +* Sat Dec 14 2019 Remi Collet - 3.11.2-1 +- update to 3.11.2 + * Tue Dec 3 2019 Remi Collet - 3.11.1-1 - update to 3.11.1 - add patches for PHP 7.4 from -- cgit