From 118092c917df5aefc5d39358936ffdec975031bf Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 3 Dec 2019 07:52:50 +0100 Subject: v3.11.1 --- 5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch | 143 +++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch (limited to '5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch') diff --git a/5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch b/5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch new file mode 100644 index 0000000..04b10d7 --- /dev/null +++ b/5b075fd0afe0e3df78ba12edb4074ccd5c131984.patch @@ -0,0 +1,143 @@ +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); -- cgit