aboutsummaryrefslogtreecommitdiffhomepage
path: root/php
diff options
context:
space:
mode:
Diffstat (limited to 'php')
-rw-r--r--php/composer.json3
-rw-r--r--php/ext/google/protobuf/array.c20
-rw-r--r--php/ext/google/protobuf/def.c62
-rw-r--r--php/ext/google/protobuf/encode_decode.c4
-rw-r--r--php/ext/google/protobuf/map.c27
-rw-r--r--php/ext/google/protobuf/message.c4
-rw-r--r--php/ext/google/protobuf/protobuf.h16
-rw-r--r--php/ext/google/protobuf/storage.c6
-rw-r--r--php/ext/google/protobuf/type_check.c118
-rw-r--r--php/ext/google/protobuf/upb.c533
-rw-r--r--php/ext/google/protobuf/upb.h16
-rwxr-xr-xphp/generate_descriptor_protos.sh16
-rw-r--r--php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php1
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorPool.php2
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorProto.php32
-rw-r--r--php/src/Google/Protobuf/Internal/EnumDescriptorProto.php4
-rw-r--r--php/src/Google/Protobuf/Internal/EnumOptions.php4
-rw-r--r--php/src/Google/Protobuf/Internal/EnumValueOptions.php4
-rw-r--r--php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php4
-rw-r--r--php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php7
-rw-r--r--php/src/Google/Protobuf/Internal/FieldOptions.php4
-rw-r--r--php/src/Google/Protobuf/Internal/FieldOptions_CType.php4
-rw-r--r--php/src/Google/Protobuf/Internal/FieldOptions_JSType.php4
-rw-r--r--php/src/Google/Protobuf/Internal/FileDescriptorProto.php28
-rw-r--r--php/src/Google/Protobuf/Internal/FileDescriptorSet.php4
-rw-r--r--php/src/Google/Protobuf/Internal/FileOptions.php47
-rw-r--r--php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php4
-rw-r--r--php/src/Google/Protobuf/Internal/GPBUtil.php68
-rw-r--r--php/src/Google/Protobuf/Internal/GPBWire.php8
-rw-r--r--php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php4
-rw-r--r--php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php4
-rw-r--r--php/src/Google/Protobuf/Internal/InputStream.php1
-rw-r--r--php/src/Google/Protobuf/Internal/MapField.php24
-rw-r--r--php/src/Google/Protobuf/Internal/Message.php12
-rw-r--r--php/src/Google/Protobuf/Internal/MessageOptions.php4
-rw-r--r--php/src/Google/Protobuf/Internal/MethodOptions.php4
-rw-r--r--php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php4
-rw-r--r--php/src/Google/Protobuf/Internal/OneofOptions.php4
-rw-r--r--php/src/Google/Protobuf/Internal/OutputStream.php15
-rw-r--r--php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php4
-rw-r--r--php/src/Google/Protobuf/Internal/ServiceOptions.php4
-rw-r--r--php/src/Google/Protobuf/Internal/SourceCodeInfo.php4
-rw-r--r--php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php12
-rw-r--r--php/src/Google/Protobuf/Internal/UninterpretedOption.php4
-rw-r--r--php/src/Google/Protobuf/descriptor.php39
-rw-r--r--php/tests/encode_decode_test.php81
-rwxr-xr-xphp/tests/gdb_test.sh2
-rw-r--r--php/tests/generated_class_test.php109
-rw-r--r--php/tests/memory_leak_test.php23
-rw-r--r--php/tests/php_implementation_test.php13
-rw-r--r--php/tests/proto/test.proto6
-rw-r--r--php/tests/proto/test_prefix.proto7
-rw-r--r--php/tests/test_base.php138
-rw-r--r--php/tests/test_util.php93
54 files changed, 1125 insertions, 544 deletions
diff --git a/php/composer.json b/php/composer.json
index 3dae2865..32b0f44c 100644
--- a/php/composer.json
+++ b/php/composer.json
@@ -18,7 +18,8 @@
"Google\\Protobuf\\": "tests/generated/Google/Protobuf",
"Google\\Protobuf\\Internal\\": "src/Google/Protobuf/Internal",
"GPBMetadata\\": "tests/generated/GPBMetadata",
- "GPBMetadata\\Google\\Protobuf\\Internal\\": "src/GPBMetadata/Google/Protobuf/Internal"
+ "GPBMetadata\\Google\\Protobuf\\Internal\\": "src/GPBMetadata/Google/Protobuf/Internal",
+ "": "tests/generated"
},
"files": [
"src/Google/Protobuf/descriptor.php"
diff --git a/php/ext/google/protobuf/array.c b/php/ext/google/protobuf/array.c
index 63bb6d0a..2186ab1f 100644
--- a/php/ext/google/protobuf/array.c
+++ b/php/ext/google/protobuf/array.c
@@ -225,8 +225,17 @@ void repeated_field_push_native(RepeatedField *intern, void *value TSRMLS_DC) {
zend_hash_next_index_insert(ht, (void **)value, size, NULL);
}
+void repeated_field_create_with_field(zend_class_entry *ce,
+ const upb_fielddef *field,
+ zval **repeated_field TSRMLS_DC) {
+ upb_fieldtype_t type = upb_fielddef_type(field);
+ const zend_class_entry *msg_ce = field_type_class(field TSRMLS_CC);
+ repeated_field_create_with_type(ce, type, msg_ce, repeated_field TSRMLS_CC);
+}
+
void repeated_field_create_with_type(zend_class_entry *ce,
- const upb_fielddef *field,
+ upb_fieldtype_t type,
+ const zend_class_entry* msg_ce,
zval **repeated_field TSRMLS_DC) {
MAKE_STD_ZVAL(*repeated_field);
Z_TYPE_PP(repeated_field) = IS_OBJECT;
@@ -235,13 +244,8 @@ void repeated_field_create_with_type(zend_class_entry *ce,
RepeatedField *intern =
zend_object_store_get_object(*repeated_field TSRMLS_CC);
- intern->type = upb_fielddef_type(field);
- if (intern->type == UPB_TYPE_MESSAGE) {
- const upb_msgdef *msg = upb_fielddef_msgsubdef(field);
- zval *desc_php = get_def_obj(msg);
- Descriptor *desc = zend_object_store_get_object(desc_php TSRMLS_CC);
- intern->msg_ce = desc->klass;
- }
+ intern->type = type;
+ intern->msg_ce = msg_ce;
MAKE_STD_ZVAL(intern->array);
repeated_field_array_init(intern->array, intern->type, 0 ZEND_FILE_LINE_CC);
diff --git a/php/ext/google/protobuf/def.c b/php/ext/google/protobuf/def.c
index 32b158e2..52b9e885 100644
--- a/php/ext/google/protobuf/def.c
+++ b/php/ext/google/protobuf/def.c
@@ -252,39 +252,54 @@ PHP_METHOD(DescriptorPool, getGeneratedPool) {
static void convert_to_class_name_inplace(char *class_name,
const char* fullname,
+ const char* prefix,
const char* package_name) {
- size_t i;
- bool first_char = false;
+ size_t i = 0, j;
+ bool first_char = true;
size_t pkg_name_len = package_name == NULL ? 0 : strlen(package_name);
+ size_t prefix_len = prefix == NULL ? 0 : strlen(prefix);
+ size_t message_name_start = package_name == NULL ? 0 : pkg_name_len + 1;
+ size_t message_len = (strlen(fullname) - message_name_start);
// In php, class name cannot be Empty.
if (strcmp("google.protobuf.Empty", fullname) == 0) {
- fullname = "google.protobuf.GPBEmpty";
+ strcpy(class_name, "\\Google\\Protobuf\\GPBEmpty");
+ return;
}
- if (pkg_name_len == 0) {
- strcpy(class_name, fullname);
- } else {
- class_name[0] = '.';
- strcpy(&class_name[1], fullname);
- for (i = 0; i <= pkg_name_len + 1; i++) {
- // PHP package uses camel case.
- if (!first_char && class_name[i] != '.') {
- first_char = true;
- class_name[i] += 'A' - 'a';
- }
+ if (pkg_name_len != 0) {
+ class_name[i++] = '\\';
+ for (j = 0; j < pkg_name_len; j++) {
// php packages are divided by '\'.
- if (class_name[i] == '.') {
+ if (package_name[j] == '.') {
+ class_name[i++] = '\\';
+ first_char = true;
+ } else if (first_char) {
+ // PHP package uses camel case.
+ if (package_name[j] < 'A' || package_name[j] > 'Z') {
+ class_name[i++] = package_name[j] + 'A' - 'a';
+ } else {
+ class_name[i++] = package_name[j];
+ }
first_char = false;
- class_name[i] = '\\';
+ } else {
+ class_name[i++] = package_name[j];
}
}
+ class_name[i++] = '\\';
+ }
+
+ if (prefix_len > 0) {
+ strcpy(class_name + i, prefix);
+ i += prefix_len;
}
// Submessage is concatenated with its containing messages by '_'.
- for (i = pkg_name_len; i < strlen(class_name); i++) {
- if (class_name[i] == '.') {
- class_name[i] = '_';
+ for (j = message_name_start; j < message_name_start + message_len; j++) {
+ if (fullname[j] == '.') {
+ class_name[i++] = '_';
+ } else {
+ class_name[i++] = fullname[j];
}
}
}
@@ -339,8 +354,13 @@ PHP_METHOD(DescriptorPool, internalAddGeneratedFile) {
* bytes allocated, one for '.', one for trailing 0, and 3 for 'GPB' if \
* given message is google.protobuf.Empty.*/ \
const char *fullname = upb_##def_type_lower##_fullname(def_type_lower); \
- char *klass_name = ecalloc(sizeof(char), 5 + strlen(fullname)); \
- convert_to_class_name_inplace(klass_name, fullname, \
+ const char *prefix = upb_filedef_phpprefix(files[0]); \
+ size_t klass_name_len = strlen(fullname) + 5; \
+ if (prefix != NULL) { \
+ klass_name_len += strlen(prefix); \
+ } \
+ char *klass_name = ecalloc(sizeof(char), klass_name_len); \
+ convert_to_class_name_inplace(klass_name, fullname, prefix, \
upb_filedef_package(files[0])); \
zend_class_entry **pce; \
if (zend_lookup_class(klass_name, strlen(klass_name), &pce TSRMLS_CC) == \
diff --git a/php/ext/google/protobuf/encode_decode.c b/php/ext/google/protobuf/encode_decode.c
index 78b12a06..e5a5f307 100644
--- a/php/ext/google/protobuf/encode_decode.c
+++ b/php/ext/google/protobuf/encode_decode.c
@@ -1234,7 +1234,7 @@ static const upb_handlers* msgdef_json_serialize_handlers(
// PHP encode/decode methods
// -----------------------------------------------------------------------------
-PHP_METHOD(Message, encode) {
+PHP_METHOD(Message, serializeToString) {
zval* php_descriptor = get_ce_obj(Z_OBJCE_P(getThis()));
Descriptor* desc =
(Descriptor*)zend_object_store_get_object(php_descriptor TSRMLS_CC);
@@ -1260,7 +1260,7 @@ PHP_METHOD(Message, encode) {
}
}
-PHP_METHOD(Message, decode) {
+PHP_METHOD(Message, mergeFromString) {
zval* php_descriptor = get_ce_obj(Z_OBJCE_P(getThis()));
Descriptor* desc =
(Descriptor*)zend_object_store_get_object(php_descriptor TSRMLS_CC);
diff --git a/php/ext/google/protobuf/map.c b/php/ext/google/protobuf/map.c
index ab98879d..fae152e3 100644
--- a/php/ext/google/protobuf/map.c
+++ b/php/ext/google/protobuf/map.c
@@ -146,6 +146,11 @@ static zend_function_entry map_field_methods[] = {
ZEND_FE_END
};
+// Forward declare static functions.
+
+static bool map_field_write_dimension(zval *object, zval *key,
+ zval *value TSRMLS_DC);
+
// -----------------------------------------------------------------------------
// MapField creation/desctruction
// -----------------------------------------------------------------------------
@@ -183,6 +188,7 @@ void map_field_init(TSRMLS_D) {
map_field_handlers = PEMALLOC(zend_object_handlers);
memcpy(map_field_handlers, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
+ map_field_handlers->write_dimension = map_field_write_dimension;
map_field_handlers->get_gc = map_field_get_gc;
}
@@ -235,7 +241,18 @@ void map_field_free(void *object TSRMLS_DC) {
efree(object);
}
-void map_field_create_with_type(zend_class_entry *ce, const upb_fielddef *field,
+void map_field_create_with_field(zend_class_entry *ce, const upb_fielddef *field,
+ zval **map_field TSRMLS_DC) {
+ const upb_fielddef *key_field = map_field_key(field);
+ const upb_fielddef *value_field = map_field_value(field);
+ map_field_create_with_type(
+ ce, upb_fielddef_type(key_field), upb_fielddef_type(value_field),
+ field_type_class(value_field TSRMLS_CC), map_field TSRMLS_CC);
+}
+
+void map_field_create_with_type(zend_class_entry *ce, upb_fieldtype_t key_type,
+ upb_fieldtype_t value_type,
+ const zend_class_entry *msg_ce,
zval **map_field TSRMLS_DC) {
MAKE_STD_ZVAL(*map_field);
Z_TYPE_PP(map_field) = IS_OBJECT;
@@ -245,11 +262,9 @@ void map_field_create_with_type(zend_class_entry *ce, const upb_fielddef *field,
Map* intern =
(Map*)zend_object_store_get_object(*map_field TSRMLS_CC);
- const upb_fielddef *key_field = map_field_key(field);
- const upb_fielddef *value_field = map_field_value(field);
- intern->key_type = upb_fielddef_type(key_field);
- intern->value_type = upb_fielddef_type(value_field);
- intern->msg_ce = field_type_class(value_field TSRMLS_CC);
+ intern->key_type = key_type;
+ intern->value_type = value_type;
+ intern->msg_ce = msg_ce;
}
static void map_field_free_element(void *object) {
diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c
index b35df311..59ce6ae6 100644
--- a/php/ext/google/protobuf/message.c
+++ b/php/ext/google/protobuf/message.c
@@ -39,8 +39,8 @@ zend_object_handlers* message_handlers;
static zend_function_entry message_methods[] = {
PHP_ME(Message, clear, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, encode, NULL, ZEND_ACC_PUBLIC)
- PHP_ME(Message, decode, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, serializeToString, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(Message, mergeFromString, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Message, jsonEncode, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Message, jsonDecode, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Message, mergeFrom, NULL, ZEND_ACC_PUBLIC)
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index 1562bbaf..2287f7e6 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -267,8 +267,8 @@ PHP_METHOD(Message, __construct);
const upb_pbdecodermethod *new_fillmsg_decodermethod(Descriptor *desc,
const void *owner);
-PHP_METHOD(Message, encode);
-PHP_METHOD(Message, decode);
+PHP_METHOD(Message, serializeToString);
+PHP_METHOD(Message, mergeFromString);
PHP_METHOD(Message, jsonEncode);
PHP_METHOD(Message, jsonDecode);
@@ -296,6 +296,7 @@ PHP_METHOD(Util, checkBool);
PHP_METHOD(Util, checkString);
PHP_METHOD(Util, checkBytes);
PHP_METHOD(Util, checkMessage);
+PHP_METHOD(Util, checkMapField);
PHP_METHOD(Util, checkRepeatedField);
// -----------------------------------------------------------------------------
@@ -349,7 +350,11 @@ const upb_fielddef* map_entry_key(const upb_msgdef* msgdef);
const upb_fielddef* map_entry_value(const upb_msgdef* msgdef);
zend_object_value map_field_create(zend_class_entry *ce TSRMLS_DC);
-void map_field_create_with_type(zend_class_entry *ce, const upb_fielddef *field,
+void map_field_create_with_field(zend_class_entry *ce, const upb_fielddef *field,
+ zval **map_field TSRMLS_DC);
+void map_field_create_with_type(zend_class_entry *ce, upb_fieldtype_t key_type,
+ upb_fieldtype_t value_type,
+ const zend_class_entry *msg_ce,
zval **map_field TSRMLS_DC);
void map_field_free(void* object TSRMLS_DC);
void* upb_value_memory(upb_value* v);
@@ -392,9 +397,12 @@ struct RepeatedFieldIter {
long position;
};
-void repeated_field_create_with_type(zend_class_entry* ce,
+void repeated_field_create_with_field(zend_class_entry* ce,
const upb_fielddef* field,
zval** repeated_field TSRMLS_DC);
+void repeated_field_create_with_type(zend_class_entry* ce, upb_fieldtype_t type,
+ const zend_class_entry* msg_ce,
+ zval** repeated_field TSRMLS_DC);
// Return the element at the index position from the repeated field. There is
// not restriction on the type of stored elements.
void *repeated_field_index_native(RepeatedField *intern, int index TSRMLS_DC);
diff --git a/php/ext/google/protobuf/storage.c b/php/ext/google/protobuf/storage.c
index 1b239ee3..af7c292f 100644
--- a/php/ext/google/protobuf/storage.c
+++ b/php/ext/google/protobuf/storage.c
@@ -517,12 +517,12 @@ void layout_init(MessageLayout* layout, void* storage,
*oneof_case = ONEOF_CASE_NONE;
} else if (is_map_field(field)) {
zval_ptr_dtor(property_ptr);
- map_field_create_with_type(map_field_type, field, property_ptr TSRMLS_CC);
+ map_field_create_with_field(map_field_type, field, property_ptr TSRMLS_CC);
DEREF(memory, zval**) = property_ptr;
} else if (upb_fielddef_label(field) == UPB_LABEL_REPEATED) {
zval_ptr_dtor(property_ptr);
- repeated_field_create_with_type(repeated_field_type, field,
- property_ptr TSRMLS_CC);
+ repeated_field_create_with_field(repeated_field_type, field,
+ property_ptr TSRMLS_CC);
DEREF(memory, zval**) = property_ptr;
} else {
native_slot_init(upb_fielddef_type(field), memory, property_ptr);
diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c
index d12d0025..fe9b18f0 100644
--- a/php/ext/google/protobuf/type_check.c
+++ b/php/ext/google/protobuf/type_check.c
@@ -51,6 +51,13 @@ ZEND_BEGIN_ARG_INFO_EX(arg_check_repeated, 0, 0, 2)
ZEND_ARG_INFO(0, klass)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arg_check_map, 0, 0, 3)
+ ZEND_ARG_INFO(1, val)
+ ZEND_ARG_INFO(0, key_type)
+ ZEND_ARG_INFO(0, value_type)
+ ZEND_ARG_INFO(0, klass)
+ZEND_END_ARG_INFO()
+
static zend_function_entry util_methods[] = {
PHP_ME(Util, checkInt32, arg_check_optional, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Util, checkUint32, arg_check_optional, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
@@ -63,6 +70,7 @@ static zend_function_entry util_methods[] = {
PHP_ME(Util, checkString, arg_check_optional, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Util, checkBytes, arg_check_optional, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Util, checkMessage, arg_check_message, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(Util, checkMapField, arg_check_map, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Util, checkRepeatedField, arg_check_repeated,
ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
@@ -411,20 +419,114 @@ PHP_METHOD(Util, checkRepeatedField) {
zval* val;
long type;
const zend_class_entry* klass = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Ol|C", &val,
- repeated_field_type, &type, &klass) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|C", &val, &type,
+ &klass) == FAILURE) {
return;
}
- RepeatedField *intern =
- (RepeatedField *)zend_object_store_get_object(val TSRMLS_CC);
- if (to_fieldtype(type) != intern->type) {
+ if (Z_TYPE_P(val) == IS_ARRAY) {
+ HashTable* table = Z_ARRVAL_P(val);
+ HashPosition pointer;
+ void* memory;
+ zval* repeated_field;
+
+ repeated_field_create_with_type(repeated_field_type, to_fieldtype(type),
+ klass, &repeated_field TSRMLS_CC);
+ RepeatedField* intern =
+ (RepeatedField*)zend_object_store_get_object(repeated_field TSRMLS_CC);
+
+ for (zend_hash_internal_pointer_reset_ex(table, &pointer);
+ zend_hash_get_current_data_ex(table, (void**)&memory, &pointer) ==
+ SUCCESS;
+ zend_hash_move_forward_ex(table, &pointer)) {
+ repeated_field_handlers->write_dimension(repeated_field, NULL,
+ *(zval**)memory TSRMLS_CC);
+ }
+
+ Z_DELREF_P(repeated_field);
+ RETURN_ZVAL(repeated_field, 1, 0);
+
+ } else if (Z_TYPE_P(val) == IS_OBJECT) {
+ if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) {
+ zend_error(E_USER_ERROR, "Given value is not an instance of %s.",
+ repeated_field_type->name);
+ return;
+ }
+ RepeatedField* intern =
+ (RepeatedField*)zend_object_store_get_object(val TSRMLS_CC);
+ if (to_fieldtype(type) != intern->type) {
+ zend_error(E_USER_ERROR, "Incorrect repeated field type.");
+ return;
+ }
+ if (klass != NULL && intern->msg_ce != klass) {
+ zend_error(E_USER_ERROR,
+ "Expect a repeated field of %s, but %s is given.", klass->name,
+ intern->msg_ce->name);
+ return;
+ }
+ RETURN_ZVAL(val, 1, 0);
+ } else {
zend_error(E_USER_ERROR, "Incorrect repeated field type.");
return;
}
- if (klass != NULL && intern->msg_ce != klass) {
- zend_error(E_USER_ERROR, "Expect a repeated field of %s, but %s is given.",
- klass->name, intern->msg_ce->name);
+
+}
+
+PHP_METHOD(Util, checkMapField) {
+ zval* val;
+ long key_type, value_type;
+ const zend_class_entry* klass = NULL;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll|C", &val, &key_type,
+ &value_type, &klass) == FAILURE) {
+ return;
+ }
+
+ if (Z_TYPE_P(val) == IS_ARRAY) {
+ HashTable* table = Z_ARRVAL_P(val);
+ HashPosition pointer;
+ zval key, *map_field;
+ void* value;
+
+ map_field_create_with_type(map_field_type, to_fieldtype(key_type),
+ to_fieldtype(value_type), klass,
+ &map_field TSRMLS_CC);
+ Map* intern =
+ (Map*)zend_object_store_get_object(map_field TSRMLS_CC);
+
+ for (zend_hash_internal_pointer_reset_ex(table, &pointer);
+ zend_hash_get_current_data_ex(table, (void**)&value, &pointer) ==
+ SUCCESS;
+ zend_hash_move_forward_ex(table, &pointer)) {
+ zend_hash_get_current_key_zval_ex(table, &key, &pointer);
+ map_field_handlers->write_dimension(map_field, &key,
+ *(zval**)value TSRMLS_CC);
+ }
+
+ Z_DELREF_P(map_field);
+ RETURN_ZVAL(map_field, 1, 0);
+ } else if (Z_TYPE_P(val) == IS_OBJECT) {
+ if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) {
+ zend_error(E_USER_ERROR, "Given value is not an instance of %s.",
+ map_field_type->name);
+ return;
+ }
+ Map* intern = (Map*)zend_object_store_get_object(val TSRMLS_CC);
+ if (to_fieldtype(key_type) != intern->key_type) {
+ zend_error(E_USER_ERROR, "Incorrect map field key type.");
+ return;
+ }
+ if (to_fieldtype(value_type) != intern->value_type) {
+ zend_error(E_USER_ERROR, "Incorrect map field value type.");
+ return;
+ }
+ if (klass != NULL && intern->msg_ce != klass) {
+ zend_error(E_USER_ERROR, "Expect a map field of %s, but %s is given.",
+ klass->name, intern->msg_ce->name);
+ return;
+ }
+ RETURN_ZVAL(val, 1, 0);
+ } else {
+ zend_error(E_USER_ERROR, "Incorrect map field type.");
return;
}
}
diff --git a/php/ext/google/protobuf/upb.c b/php/ext/google/protobuf/upb.c
index e0c56f8e..70983016 100644
--- a/php/ext/google/protobuf/upb.c
+++ b/php/ext/google/protobuf/upb.c
@@ -377,13 +377,14 @@ bool _upb_def_validate(upb_def *const*defs, size_t n, upb_status *s) {
} else if (def->type == UPB_DEF_FIELD) {
upb_status_seterrmsg(s, "standalone fielddefs can not be frozen");
goto err;
- } else if (def->type == UPB_DEF_ENUM) {
- if (!upb_validate_enumdef(upb_dyncast_enumdef(def), s)) {
- goto err;
- }
} else {
/* Set now to detect transitive closure in the second pass. */
def->came_from_user = true;
+
+ if (def->type == UPB_DEF_ENUM &&
+ !upb_validate_enumdef(upb_dyncast_enumdef(def), s)) {
+ goto err;
+ }
}
}
@@ -710,43 +711,6 @@ upb_fielddef *upb_fielddef_new(const void *o) {
return f;
}
-static upb_fielddef *upb_fielddef_dup(const upb_fielddef *f,
- const void *owner) {
- const char *srcname;
- upb_fielddef *newf = upb_fielddef_new(owner);
- if (!newf) return NULL;
- upb_fielddef_settype(newf, upb_fielddef_type(f));
- upb_fielddef_setlabel(newf, upb_fielddef_label(f));
- upb_fielddef_setnumber(newf, upb_fielddef_number(f), NULL);
- upb_fielddef_setname(newf, upb_fielddef_name(f), NULL);
- if (f->default_is_string && f->defaultval.bytes) {
- str_t *s = f->defaultval.bytes;
- upb_fielddef_setdefaultstr(newf, s->str, s->len, NULL);
- } else {
- newf->default_is_string = f->default_is_string;
- newf->defaultval = f->defaultval;
- }
-
- if (f->subdef_is_symbolic) {
- srcname = f->sub.name; /* Might be NULL. */
- } else {
- srcname = f->sub.def ? upb_def_fullname(f->sub.def) : NULL;
- }
- if (srcname) {
- char *newname = upb_gmalloc(strlen(f->sub.def->fullname) + 2);
- if (!newname) {
- upb_fielddef_unref(newf, owner);
- return NULL;
- }
- strcpy(newname, ".");
- strcat(newname, f->sub.def->fullname);
- upb_fielddef_setsubdefname(newf, newname, NULL);
- upb_gfree(newname);
- }
-
- return newf;
-}
-
bool upb_fielddef_typeisset(const upb_fielddef *f) {
return f->type_is_set_;
}
@@ -1426,44 +1390,6 @@ err2:
return NULL;
}
-static upb_oneofdef *upb_oneofdef_dup(const upb_oneofdef *o, const void *owner);
-
-static upb_msgdef *upb_msgdef_dup(const upb_msgdef *m, const void *owner) {
- bool ok;
- upb_msg_field_iter i;
- upb_msg_oneof_iter o;
-
- upb_msgdef *newm = upb_msgdef_new(owner);
- if (!newm) return NULL;
- ok = upb_def_setfullname(upb_msgdef_upcast_mutable(newm),
- upb_def_fullname(upb_msgdef_upcast(m)),
- NULL);
- newm->map_entry = m->map_entry;
- newm->syntax = m->syntax;
- UPB_ASSERT(ok);
- for(upb_msg_field_begin(&i, m);
- !upb_msg_field_done(&i);
- upb_msg_field_next(&i)) {
- upb_fielddef *f = upb_fielddef_dup(upb_msg_iter_field(&i), &f);
- /* Fields in oneofs are dup'd below. */
- if (upb_fielddef_containingoneof(f)) continue;
- if (!f || !upb_msgdef_addfield(newm, f, &f, NULL)) {
- upb_msgdef_unref(newm, owner);
- return NULL;
- }
- }
- for(upb_msg_oneof_begin(&o, m);
- !upb_msg_oneof_done(&o);
- upb_msg_oneof_next(&o)) {
- upb_oneofdef *f = upb_oneofdef_dup(upb_msg_iter_oneof(&o), &f);
- if (!f || !upb_msgdef_addoneof(newm, f, &f, NULL)) {
- upb_msgdef_unref(newm, owner);
- return NULL;
- }
- }
- return newm;
-}
-
bool upb_msgdef_freeze(upb_msgdef *m, upb_status *status) {
upb_def *d = upb_msgdef_upcast_mutable(m);
return upb_def_freeze(&d, 1, status);
@@ -1764,24 +1690,6 @@ err2:
return NULL;
}
-static upb_oneofdef *upb_oneofdef_dup(const upb_oneofdef *o,
- const void *owner) {
- bool ok;
- upb_oneof_iter i;
- upb_oneofdef *newo = upb_oneofdef_new(owner);
- if (!newo) return NULL;
- ok = upb_oneofdef_setname(newo, upb_oneofdef_name(o), NULL);
- UPB_ASSERT(ok);
- for (upb_oneof_begin(&i, o); !upb_oneof_done(&i); upb_oneof_next(&i)) {
- upb_fielddef *f = upb_fielddef_dup(upb_oneof_iter_field(&i), &f);
- if (!f || !upb_oneofdef_addfield(newo, f, &f, NULL)) {
- upb_oneofdef_unref(newo, owner);
- return NULL;
- }
- }
- return newo;
-}
-
const char *upb_oneofdef_name(const upb_oneofdef *o) { return o->name; }
bool upb_oneofdef_setname(upb_oneofdef *o, const char *name, upb_status *s) {
@@ -1950,6 +1858,7 @@ static void freefiledef(upb_refcounted *r) {
upb_inttable_uninit(&f->deps);
upb_gfree((void*)f->name);
upb_gfree((void*)f->package);
+ upb_gfree((void*)f->phpprefix);
upb_gfree(f);
}
@@ -1964,6 +1873,7 @@ upb_filedef *upb_filedef_new(const void *owner) {
f->package = NULL;
f->name = NULL;
+ f->phpprefix = NULL;
f->syntax = UPB_SYNTAX_PROTO2;
if (!upb_refcounted_init(upb_filedef_upcast_mutable(f), &upb_filedef_vtbl,
@@ -1998,6 +1908,10 @@ const char *upb_filedef_package(const upb_filedef *f) {
return f->package;
}
+const char *upb_filedef_phpprefix(const upb_filedef *f) {
+ return f->phpprefix;
+}
+
upb_syntax_t upb_filedef_syntax(const upb_filedef *f) {
return f->syntax;
}
@@ -2054,6 +1968,18 @@ bool upb_filedef_setpackage(upb_filedef *f, const char *package,
return true;
}
+bool upb_filedef_setphpprefix(upb_filedef *f, const char *phpprefix,
+ upb_status *s) {
+ phpprefix = upb_gstrdup(phpprefix);
+ if (!phpprefix) {
+ upb_upberr_setoom(s);
+ return false;
+ }
+ upb_gfree((void*)f->phpprefix);
+ f->phpprefix = phpprefix;
+ return true;
+}
+
bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax,
upb_status *s) {
UPB_UNUSED(s);
@@ -2240,57 +2166,14 @@ static bool symtab_add(upb_symtab *s, upb_def *const*defs, size_t n,
fullname);
goto err;
}
- upb_def_donateref(def, ref_donor, s);
if (!upb_strtable_insert(&addtab, fullname, upb_value_ptr(def)))
goto oom_err;
- def->came_from_user = true;
- }
- }
-
- /* Add standalone fielddefs (ie. extensions) to the appropriate messages.
- * If the appropriate message only exists in the existing symtab, duplicate
- * it so we have a mutable copy we can add the fields to. */
- for (i = 0; i < n; i++) {
- upb_def *def = defs[i];
- upb_fielddef *f = upb_dyncast_fielddef_mutable(def);
- const char *msgname;
- upb_value v;
- upb_msgdef *m;
-
- if (!f) continue;
- msgname = upb_fielddef_containingtypename(f);
- /* We validated this earlier in this function. */
- UPB_ASSERT(msgname);
-
- /* If the extendee name is absolutely qualified, move past the initial ".".
- * TODO(haberman): it is not obvious what it would mean if this was not
- * absolutely qualified. */
- if (msgname[0] == '.') {
- msgname++;
- }
-
- if (upb_strtable_lookup(&addtab, msgname, &v)) {
- /* Extendee is in the set of defs the user asked us to add. */
- m = upb_value_getptr(v);
- } else {
- /* Need to find and dup the extendee from the existing symtab. */
- const upb_msgdef *frozen_m = upb_symtab_lookupmsg(s, msgname);
- if (!frozen_m) {
- upb_status_seterrf(status,
- "Tried to extend message %s that does not exist "
- "in this SymbolTable.",
- msgname);
- goto err;
- }
- m = upb_msgdef_dup(frozen_m, s);
- if (!m) goto oom_err;
- if (!upb_strtable_insert(&addtab, msgname, upb_value_ptr(m))) {
- upb_msgdef_unref(m, s);
- goto oom_err;
- }
+ upb_def_donateref(def, ref_donor, s);
}
- if (!upb_msgdef_addfield(m, f, ref_donor, status)) {
+ if (upb_dyncast_fielddef_mutable(def)) {
+ /* TODO(haberman): allow adding extensions attached to files. */
+ upb_status_seterrf(status, "Can't add extensions to symtab.\n");
goto err;
}
}
@@ -2372,15 +2255,9 @@ static bool symtab_add(upb_symtab *s, upb_def *const*defs, size_t n,
for (i = 0; i < add_n; i++) {
upb_def *def = (upb_def*)add_objs[i];
const char *name = upb_def_fullname(def);
- upb_value v;
bool success;
-
- if (upb_strtable_remove(&s->symtab, name, &v)) {
- const upb_def *def = upb_value_getptr(v);
- upb_def_unref(def, s);
- }
success = upb_strtable_insert(&s->symtab, name, upb_value_ptr(def));
- UPB_ASSERT(success == true);
+ UPB_ASSERT(success);
}
upb_gfree(add_defs);
return true;
@@ -3737,8 +3614,7 @@ static bool upb_visitor_visitmsg2(const upb_msg *msg,
CHECK_TRUE(upb_sink_putfloat(sink, sel, upb_msgval_getfloat(val)));
break;
case UPB_TYPE_DOUBLE:
- CHECK_TRUE(
- upb_sink_putdouble(sink, sel, upb_msgval_getdouble(val)));
+ CHECK_TRUE(upb_sink_putdouble(sink, sel, upb_msgval_getdouble(val)));
break;
case UPB_TYPE_BOOL:
CHECK_TRUE(upb_sink_putbool(sink, sel, upb_msgval_getbool(val)));
@@ -3748,15 +3624,13 @@ static bool upb_visitor_visitmsg2(const upb_msg *msg,
CHECK_TRUE(upb_sink_putint32(sink, sel, upb_msgval_getint32(val)));
break;
case UPB_TYPE_UINT32:
- CHECK_TRUE(
- upb_sink_putuint32(sink, sel, upb_msgval_getuint32(val)));
+ CHECK_TRUE(upb_sink_putuint32(sink, sel, upb_msgval_getuint32(val)));
break;
case UPB_TYPE_INT64:
CHECK_TRUE(upb_sink_putint64(sink, sel, upb_msgval_getint64(val)));
break;
case UPB_TYPE_UINT64:
- CHECK_TRUE(
- upb_sink_putuint64(sink, sel, upb_msgval_getuint64(val)));
+ CHECK_TRUE(upb_sink_putuint64(sink, sel, upb_msgval_getuint64(val)));
break;
case UPB_TYPE_STRING:
case UPB_TYPE_BYTES:
@@ -6545,14 +6419,14 @@ size_t upb_env_bytesallocated(const upb_env *e) {
static const upb_msgdef msgs[22];
-static const upb_fielddef fields[105];
+static const upb_fielddef fields[106];
static const upb_enumdef enums[5];
static const upb_tabent strentries[236];
static const upb_tabent intentries[18];
-static const upb_tabval arrays[184];
+static const upb_tabval arrays[186];
#ifdef UPB_DEBUG_REFS
-static upb_inttable reftables[264];
+static upb_inttable reftables[266];
#endif
static const upb_msgdef msgs[22] = {
@@ -6567,20 +6441,20 @@ static const upb_msgdef msgs[22] = {
UPB_MSGDEF_INIT("google.protobuf.FieldOptions", 12, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[4], &arrays[42], 11, 6), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[56]), false, UPB_SYNTAX_PROTO2, &reftables[16], &reftables[17]),
UPB_MSGDEF_INIT("google.protobuf.FileDescriptorProto", 42, 6, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[53], 13, 12), UPB_STRTABLE_INIT(12, 15, UPB_CTYPE_PTR, 4, &strentries[72]), false, UPB_SYNTAX_PROTO2, &reftables[18], &reftables[19]),
UPB_MSGDEF_INIT("google.protobuf.FileDescriptorSet", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[66], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[88]), false, UPB_SYNTAX_PROTO2, &reftables[20], &reftables[21]),
- UPB_MSGDEF_INIT("google.protobuf.FileOptions", 31, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 39, 15), UPB_STRTABLE_INIT(16, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]),
- UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 10, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[107], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]),
- UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 15, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[115], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]),
- UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[122], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]),
- UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[123], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[125], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]),
- UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[129], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[130], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]),
- UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 19, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[132], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[139], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]),
- UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[148], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]),
+ UPB_MSGDEF_INIT("google.protobuf.FileOptions", 34, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[6], &arrays[68], 41, 16), UPB_STRTABLE_INIT(17, 31, UPB_CTYPE_PTR, 5, &strentries[92]), false, UPB_SYNTAX_PROTO2, &reftables[22], &reftables[23]),
+ UPB_MSGDEF_INIT("google.protobuf.MessageOptions", 10, 1, UPB_INTTABLE_INIT(1, 1, UPB_CTYPE_PTR, 1, &intentries[8], &arrays[109], 8, 4), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[124]), false, UPB_SYNTAX_PROTO2, &reftables[24], &reftables[25]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodDescriptorProto", 15, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[117], 7, 6), UPB_STRTABLE_INIT(6, 7, UPB_CTYPE_PTR, 3, &strentries[132]), false, UPB_SYNTAX_PROTO2, &reftables[26], &reftables[27]),
+ UPB_MSGDEF_INIT("google.protobuf.MethodOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[10], &arrays[124], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[140]), false, UPB_SYNTAX_PROTO2, &reftables[28], &reftables[29]),
+ UPB_MSGDEF_INIT("google.protobuf.OneofDescriptorProto", 5, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[125], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[144]), false, UPB_SYNTAX_PROTO2, &reftables[30], &reftables[31]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceDescriptorProto", 11, 2, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[127], 4, 3), UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_PTR, 2, &strentries[148]), false, UPB_SYNTAX_PROTO2, &reftables[32], &reftables[33]),
+ UPB_MSGDEF_INIT("google.protobuf.ServiceOptions", 7, 1, UPB_INTTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &intentries[14], &arrays[131], 1, 0), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[152]), false, UPB_SYNTAX_PROTO2, &reftables[34], &reftables[35]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo", 6, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[132], 2, 1), UPB_STRTABLE_INIT(1, 3, UPB_CTYPE_PTR, 2, &strentries[156]), false, UPB_SYNTAX_PROTO2, &reftables[36], &reftables[37]),
+ UPB_MSGDEF_INIT("google.protobuf.SourceCodeInfo.Location", 19, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[134], 7, 5), UPB_STRTABLE_INIT(5, 7, UPB_CTYPE_PTR, 3, &strentries[160]), false, UPB_SYNTAX_PROTO2, &reftables[38], &reftables[39]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption", 18, 1, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[141], 9, 7), UPB_STRTABLE_INIT(7, 15, UPB_CTYPE_PTR, 4, &strentries[168]), false, UPB_SYNTAX_PROTO2, &reftables[40], &reftables[41]),
+ UPB_MSGDEF_INIT("google.protobuf.UninterpretedOption.NamePart", 6, 0, UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_PTR, 0, NULL, &arrays[150], 3, 2), UPB_STRTABLE_INIT(2, 3, UPB_CTYPE_PTR, 2, &strentries[184]), false, UPB_SYNTAX_PROTO2, &reftables[42], &reftables[43]),
};
-static const upb_fielddef fields[105] = {
+static const upb_fielddef fields[106] = {
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "aggregate_value", 8, &msgs[20], NULL, 15, 6, {0},&reftables[44], &reftables[45]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "allow_alias", 2, &msgs[4], NULL, 6, 1, {0},&reftables[46], &reftables[47]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "cc_enable_arenas", 31, &msgs[11], NULL, 23, 12, {0},&reftables[48], &reftables[49]),
@@ -6590,18 +6464,18 @@ static const upb_fielddef fields[105] = {
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "ctype", 1, &msgs[8], (const upb_def*)(&enums[2]), 6, 1, {0},&reftables[56], &reftables[57]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "default_value", 7, &msgs[7], NULL, 16, 7, {0},&reftables[58], &reftables[59]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "dependency", 3, &msgs[9], NULL, 30, 8, {0},&reftables[60], &reftables[61]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 8, 3, {0},&reftables[62], &reftables[63]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 8, 3, {0},&reftables[64], &reftables[65]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 6, 1, {0},&reftables[66], &reftables[67]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[8], NULL, 8, 3, {0},&reftables[62], &reftables[63]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[14], NULL, 6, 1, {0},&reftables[64], &reftables[65]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[12], NULL, 8, 3, {0},&reftables[66], &reftables[67]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 23, &msgs[11], NULL, 21, 10, {0},&reftables[68], &reftables[69]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 7, 2, {0},&reftables[70], &reftables[71]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 6, 1, {0},&reftables[72], &reftables[73]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 6, 1, {0},&reftables[74], &reftables[75]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 1, &msgs[6], NULL, 6, 1, {0},&reftables[70], &reftables[71]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 3, &msgs[4], NULL, 7, 2, {0},&reftables[72], &reftables[73]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "deprecated", 33, &msgs[17], NULL, 6, 1, {0},&reftables[74], &reftables[75]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_DOUBLE, 0, false, false, false, false, "double_value", 6, &msgs[20], NULL, 11, 4, {0},&reftables[76], &reftables[77]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[2], NULL, 3, 1, {0},&reftables[78], &reftables[79]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "end", 2, &msgs[1], NULL, 3, 1, {0},&reftables[80], &reftables[81]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 18, 2, {0},&reftables[82], &reftables[83]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 13, 1, {0},&reftables[84], &reftables[85]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 5, &msgs[9], (const upb_def*)(&msgs[3]), 13, 1, {0},&reftables[82], &reftables[83]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "enum_type", 4, &msgs[0], (const upb_def*)(&msgs[3]), 18, 2, {0},&reftables[84], &reftables[85]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "extendee", 2, &msgs[7], NULL, 7, 2, {0},&reftables[86], &reftables[87]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 6, &msgs[0], (const upb_def*)(&msgs[7]), 24, 4, {0},&reftables[88], &reftables[89]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "extension", 7, &msgs[9], (const upb_def*)(&msgs[7]), 19, 3, {0},&reftables[90], &reftables[91]),
@@ -6630,15 +6504,15 @@ static const upb_fielddef fields[105] = {
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "message_set_wire_format", 1, &msgs[12], NULL, 6, 1, {0},&reftables[136], &reftables[137]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "message_type", 4, &msgs[9], (const upb_def*)(&msgs[0]), 10, 0, {0},&reftables[138], &reftables[139]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "method", 2, &msgs[16], (const upb_def*)(&msgs[13]), 6, 0, {0},&reftables[140], &reftables[141]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[142], &reftables[143]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[144], &reftables[145]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 5, 0, {0},&reftables[146], &reftables[147]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 32, 8, {0},&reftables[148], &reftables[149]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[150], &reftables[151]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[152], &reftables[153]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 4, 1, {0},&reftables[154], &reftables[155]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[156], &reftables[157]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 8, 2, {0},&reftables[158], &reftables[159]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "name", 2, &msgs[20], (const upb_def*)(&msgs[21]), 5, 0, {0},&reftables[142], &reftables[143]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[0], NULL, 32, 8, {0},&reftables[144], &reftables[145]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[5], NULL, 4, 1, {0},&reftables[146], &reftables[147]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[13], NULL, 4, 1, {0},&reftables[148], &reftables[149]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[16], NULL, 8, 2, {0},&reftables[150], &reftables[151]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[3], NULL, 8, 2, {0},&reftables[152], &reftables[153]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[15], NULL, 2, 0, {0},&reftables[154], &reftables[155]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[7], NULL, 4, 1, {0},&reftables[156], &reftables[157]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "name", 1, &msgs[9], NULL, 22, 6, {0},&reftables[158], &reftables[159]),
UPB_FIELDDEF_INIT(UPB_LABEL_REQUIRED, UPB_TYPE_STRING, 0, false, false, false, false, "name_part", 1, &msgs[21], NULL, 2, 0, {0},&reftables[160], &reftables[161]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT64, UPB_INTFMT_VARIABLE, false, false, false, false, "negative_int_value", 5, &msgs[20], NULL, 10, 3, {0},&reftables[162], &reftables[163]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "nested_type", 3, &msgs[0], (const upb_def*)(&msgs[0]), 15, 1, {0},&reftables[164], &reftables[165]),
@@ -6649,58 +6523,59 @@ static const upb_fielddef fields[105] = {
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "oneof_decl", 8, &msgs[0], (const upb_def*)(&msgs[15]), 28, 6, {0},&reftables[174], &reftables[175]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "oneof_index", 9, &msgs[7], NULL, 19, 8, {0},&reftables[176], &reftables[177]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "optimize_for", 9, &msgs[11], (const upb_def*)(&enums[4]), 12, 3, {0},&reftables[178], &reftables[179]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[180], &reftables[181]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[182], &reftables[183]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[9], (const upb_def*)(&msgs[11]), 20, 4, {0},&reftables[180], &reftables[181]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 7, &msgs[0], (const upb_def*)(&msgs[12]), 25, 5, {0},&reftables[182], &reftables[183]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 4, &msgs[13], (const upb_def*)(&msgs[14]), 3, 0, {0},&reftables[184], &reftables[185]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 8, &msgs[7], (const upb_def*)(&msgs[8]), 3, 0, {0},&reftables[186], &reftables[187]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[188], &reftables[189]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[190], &reftables[191]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[5], (const upb_def*)(&msgs[6]), 3, 0, {0},&reftables[188], &reftables[189]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[16], (const upb_def*)(&msgs[17]), 7, 1, {0},&reftables[190], &reftables[191]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "options", 3, &msgs[3], (const upb_def*)(&msgs[4]), 7, 1, {0},&reftables[192], &reftables[193]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "output_type", 3, &msgs[13], NULL, 10, 3, {0},&reftables[194], &reftables[195]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "package", 2, &msgs[9], NULL, 25, 7, {0},&reftables[196], &reftables[197]),
UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "packed", 2, &msgs[8], NULL, 7, 2, {0},&reftables[198], &reftables[199]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "path", 1, &msgs[19], NULL, 4, 0, {0},&reftables[200], &reftables[201]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 9, 2, {0},&reftables[202], &reftables[203]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 35, 9, {0},&reftables[204], &reftables[205]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 19, 8, {0},&reftables[206], &reftables[207]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 37, 9, {0},&reftables[208], &reftables[209]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 31, 7, {0},&reftables[210], &reftables[211]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 14, 5, {0},&reftables[212], &reftables[213]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 16, 2, {0},&reftables[214], &reftables[215]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 21, 5, {0},&reftables[216], &reftables[217]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 7, 1, {0},&reftables[218], &reftables[219]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[220], &reftables[221]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[222], &reftables[223]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 12, 5, {0},&reftables[224], &reftables[225]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 39, 11, {0},&reftables[226], &reftables[227]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 11, 3, {0},&reftables[228], &reftables[229]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 12, 5, {0},&reftables[230], &reftables[231]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 13, 6, {0},&reftables[232], &reftables[233]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[234], &reftables[235]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[236], &reftables[237]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[238], &reftables[239]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[240], &reftables[241]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "php_class_prefix", 40, &msgs[11], NULL, 31, 16, {0},&reftables[202], &reftables[203]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_UINT64, UPB_INTFMT_VARIABLE, false, false, false, false, "positive_int_value", 4, &msgs[20], NULL, 9, 2, {0},&reftables[204], &reftables[205]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "public_dependency", 10, &msgs[9], NULL, 35, 9, {0},&reftables[206], &reftables[207]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "py_generic_services", 18, &msgs[11], NULL, 19, 8, {0},&reftables[208], &reftables[209]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_STRING, 0, false, false, false, false, "reserved_name", 10, &msgs[0], NULL, 37, 9, {0},&reftables[210], &reftables[211]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "reserved_range", 9, &msgs[0], (const upb_def*)(&msgs[2]), 31, 7, {0},&reftables[212], &reftables[213]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "server_streaming", 6, &msgs[13], NULL, 14, 5, {0},&reftables[214], &reftables[215]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "service", 6, &msgs[9], (const upb_def*)(&msgs[16]), 16, 2, {0},&reftables[216], &reftables[217]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_MESSAGE, 0, false, false, false, false, "source_code_info", 9, &msgs[9], (const upb_def*)(&msgs[18]), 21, 5, {0},&reftables[218], &reftables[219]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, true, "span", 2, &msgs[19], NULL, 7, 1, {0},&reftables[220], &reftables[221]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[2], NULL, 2, 0, {0},&reftables[222], &reftables[223]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "start", 1, &msgs[1], NULL, 2, 0, {0},&reftables[224], &reftables[225]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BYTES, 0, false, false, false, false, "string_value", 7, &msgs[20], NULL, 12, 5, {0},&reftables[226], &reftables[227]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "syntax", 12, &msgs[9], NULL, 39, 11, {0},&reftables[228], &reftables[229]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "trailing_comments", 4, &msgs[19], NULL, 11, 3, {0},&reftables[230], &reftables[231]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_ENUM, 0, false, false, false, false, "type", 5, &msgs[7], (const upb_def*)(&enums[1]), 12, 5, {0},&reftables[232], &reftables[233]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_STRING, 0, false, false, false, false, "type_name", 6, &msgs[7], NULL, 13, 6, {0},&reftables[234], &reftables[235]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[236], &reftables[237]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[12], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[238], &reftables[239]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[240], &reftables[241]),
UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[8], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[242], &reftables[243]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[14], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[17], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 6, 0, {0},&reftables[248], &reftables[249]),
- UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 11, 6, {0},&reftables[250], &reftables[251]),
- UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 38, 10, {0},&reftables[252], &reftables[253]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[11], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[244], &reftables[245]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[6], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[246], &reftables[247]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "uninterpreted_option", 999, &msgs[4], (const upb_def*)(&msgs[20]), 5, 0, {0},&reftables[248], &reftables[249]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_MESSAGE, 0, false, false, false, false, "value", 2, &msgs[3], (const upb_def*)(&msgs[5]), 6, 0, {0},&reftables[250], &reftables[251]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_OPTIONAL, UPB_TYPE_BOOL, 0, false, false, false, false, "weak", 10, &msgs[8], NULL, 11, 6, {0},&reftables[252], &reftables[253]),
+ UPB_FIELDDEF_INIT(UPB_LABEL_REPEATED, UPB_TYPE_INT32, UPB_INTFMT_VARIABLE, false, false, false, false, "weak_dependency", 11, &msgs[9], NULL, 38, 10, {0},&reftables[254], &reftables[255]),
};
static const upb_enumdef enums[5] = {
- UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[188]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[151], 4, 3), 0, &reftables[254], &reftables[255]),
- UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &strentries[192]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[155], 19, 18), 0, &reftables[256], &reftables[257]),
- UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[224]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[174], 3, 3), 0, &reftables[258], &reftables[259]),
- UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.JSType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[228]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[177], 3, 3), 0, &reftables[260], &reftables[261]),
- UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[232]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[180], 4, 3), 0, &reftables[262], &reftables[263]),
+ UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Label", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[188]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[153], 4, 3), 0, &reftables[256], &reftables[257]),
+ UPB_ENUMDEF_INIT("google.protobuf.FieldDescriptorProto.Type", UPB_STRTABLE_INIT(18, 31, UPB_CTYPE_INT32, 5, &strentries[192]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[157], 19, 18), 0, &reftables[258], &reftables[259]),
+ UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.CType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[224]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[176], 3, 3), 0, &reftables[260], &reftables[261]),
+ UPB_ENUMDEF_INIT("google.protobuf.FieldOptions.JSType", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[228]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[179], 3, 3), 0, &reftables[262], &reftables[263]),
+ UPB_ENUMDEF_INIT("google.protobuf.FileOptions.OptimizeMode", UPB_STRTABLE_INIT(3, 3, UPB_CTYPE_INT32, 2, &strentries[232]), UPB_INTTABLE_INIT(0, 0, UPB_CTYPE_CSTR, 0, NULL, &arrays[182], 4, 3), 0, &reftables[264], &reftables[265]),
};
static const upb_tabent strentries[236] = {
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[22]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\015", "\000", "\000", "\000", "reserved_name"), UPB_TABVALUE_PTR_INIT(&fields[82]), NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[52]), NULL},
+ {UPB_TABKEY_STR("\015", "\000", "\000", "\000", "reserved_name"), UPB_TABVALUE_PTR_INIT(&fields[83]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[50]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6709,38 +6584,38 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "nested_type"), UPB_TABVALUE_PTR_INIT(&fields[60]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\016", "\000", "\000", "\000", "reserved_range"), UPB_TABVALUE_PTR_INIT(&fields[83]), NULL},
- {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[68]), NULL},
+ {UPB_TABKEY_STR("\016", "\000", "\000", "\000", "reserved_range"), UPB_TABVALUE_PTR_INIT(&fields[84]), NULL},
+ {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[69]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "oneof_decl"), UPB_TABVALUE_PTR_INIT(&fields[65]), NULL},
- {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[19]), &strentries[13]},
- {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[89]), NULL},
+ {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[20]), &strentries[13]},
+ {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[90]), NULL},
{UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[18]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[88]), NULL},
+ {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "start"), UPB_TABVALUE_PTR_INIT(&fields[89]), NULL},
{UPB_TABKEY_STR("\003", "\000", "\000", "\000", "end"), UPB_TABVALUE_PTR_INIT(&fields[17]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "value"), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL},
+ {UPB_TABKEY_STR("\005", "\000", "\000", "\000", "value"), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[74]), NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[49]), &strentries[26]},
- {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
- {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[13]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[54]), &strentries[26]},
+ {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL},
+ {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL},
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "allow_alias"), UPB_TABVALUE_PTR_INIT(&fields[1]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[62]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[73]), NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[53]), &strentries[34]},
- {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL},
- {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[15]), NULL},
+ {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[72]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[51]), &strentries[34]},
+ {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
+ {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[13]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "oneof_index"), UPB_TABVALUE_PTR_INIT(&fields[66]), NULL},
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "label"), UPB_TABVALUE_PTR_INIT(&fields[40]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[55]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[56]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6748,14 +6623,14 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "number"), UPB_TABVALUE_PTR_INIT(&fields[63]), &strentries[53]},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\010", "\000", "\000", "\000", "extendee"), UPB_TABVALUE_PTR_INIT(&fields[21]), NULL},
- {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "type_name"), UPB_TABVALUE_PTR_INIT(&fields[94]), NULL},
+ {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "type_name"), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "json_name"), UPB_TABVALUE_PTR_INIT(&fields[38]), NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "type"), UPB_TABVALUE_PTR_INIT(&fields[93]), &strentries[50]},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "type"), UPB_TABVALUE_PTR_INIT(&fields[94]), &strentries[50]},
{UPB_TABKEY_STR("\015", "\000", "\000", "\000", "default_value"), UPB_TABVALUE_PTR_INIT(&fields[7]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[71]), NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "weak"), UPB_TABVALUE_PTR_INIT(&fields[103]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "weak"), UPB_TABVALUE_PTR_INIT(&fields[104]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6766,25 +6641,25 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_STR("\005", "\000", "\000", "\000", "ctype"), UPB_TABVALUE_PTR_INIT(&fields[6]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "jstype"), UPB_TABVALUE_PTR_INIT(&fields[39]), NULL},
- {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL},
+ {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[9]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "extension"), UPB_TABVALUE_PTR_INIT(&fields[23]), NULL},
- {UPB_TABKEY_STR("\017", "\000", "\000", "\000", "weak_dependency"), UPB_TABVALUE_PTR_INIT(&fields[104]), NULL},
+ {UPB_TABKEY_STR("\017", "\000", "\000", "\000", "weak_dependency"), UPB_TABVALUE_PTR_INIT(&fields[105]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[54]), NULL},
- {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "service"), UPB_TABVALUE_PTR_INIT(&fields[85]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[57]), NULL},
+ {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "service"), UPB_TABVALUE_PTR_INIT(&fields[86]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "source_code_info"), UPB_TABVALUE_PTR_INIT(&fields[86]), NULL},
+ {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "source_code_info"), UPB_TABVALUE_PTR_INIT(&fields[87]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "syntax"), UPB_TABVALUE_PTR_INIT(&fields[91]), NULL},
+ {UPB_TABKEY_STR("\006", "\000", "\000", "\000", "syntax"), UPB_TABVALUE_PTR_INIT(&fields[92]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "dependency"), UPB_TABVALUE_PTR_INIT(&fields[8]), NULL},
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "message_type"), UPB_TABVALUE_PTR_INIT(&fields[47]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "package"), UPB_TABVALUE_PTR_INIT(&fields[76]), NULL},
- {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[69]), &strentries[86]},
- {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[20]), NULL},
- {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "public_dependency"), UPB_TABVALUE_PTR_INIT(&fields[80]), &strentries[85]},
+ {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[68]), &strentries[86]},
+ {UPB_TABKEY_STR("\011", "\000", "\000", "\000", "enum_type"), UPB_TABVALUE_PTR_INIT(&fields[19]), NULL},
+ {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "public_dependency"), UPB_TABVALUE_PTR_INIT(&fields[81]), &strentries[85]},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "file"), UPB_TABVALUE_PTR_INIT(&fields[26]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6792,7 +6667,7 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\023", "\000", "\000", "\000", "cc_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[3]), NULL},
- {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "csharp_namespace"), UPB_TABVALUE_PTR_INIT(&fields[5]), NULL},
+ {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "csharp_namespace"), UPB_TABVALUE_PTR_INIT(&fields[5]), &strentries[116]},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6805,7 +6680,7 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\024", "\000", "\000", "\000", "java_outer_classname"), UPB_TABVALUE_PTR_INIT(&fields[34]), NULL},
- {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL},
+ {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6813,9 +6688,9 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\025", "\000", "\000", "\000", "java_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[32]), &strentries[118]},
{UPB_TABKEY_STR("\035", "\000", "\000", "\000", "java_generate_equals_and_hash"), UPB_TABVALUE_PTR_INIT(&fields[31]), NULL},
- {UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
+ {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "php_class_prefix"), UPB_TABVALUE_PTR_INIT(&fields[79]), NULL},
{UPB_TABKEY_STR("\037", "\000", "\000", "\000", "javanano_use_deprecated_package"), UPB_TABVALUE_PTR_INIT(&fields[37]), &strentries[123]},
- {UPB_TABKEY_STR("\023", "\000", "\000", "\000", "py_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[81]), NULL},
+ {UPB_TABKEY_STR("\023", "\000", "\000", "\000", "py_generic_services"), UPB_TABVALUE_PTR_INIT(&fields[82]), NULL},
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "optimize_for"), UPB_TABVALUE_PTR_INIT(&fields[67]), NULL},
{UPB_TABKEY_STR("\026", "\000", "\000", "\000", "java_string_check_utf8"), UPB_TABVALUE_PTR_INIT(&fields[36]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[12]), &strentries[119]},
@@ -6825,32 +6700,32 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL},
- {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[9]), NULL},
+ {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL},
+ {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL},
{UPB_TABKEY_STR("\011", "\000", "\000", "\000", "map_entry"), UPB_TABVALUE_PTR_INIT(&fields[45]), NULL},
{UPB_TABKEY_STR("\037", "\000", "\000", "\000", "no_standard_descriptor_accessor"), UPB_TABVALUE_PTR_INIT(&fields[61]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "client_streaming"), UPB_TABVALUE_PTR_INIT(&fields[4]), NULL},
- {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "server_streaming"), UPB_TABVALUE_PTR_INIT(&fields[84]), NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[56]), NULL},
+ {UPB_TABKEY_STR("\020", "\000", "\000", "\000", "server_streaming"), UPB_TABVALUE_PTR_INIT(&fields[85]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[52]), NULL},
{UPB_TABKEY_STR("\012", "\000", "\000", "\000", "input_type"), UPB_TABVALUE_PTR_INIT(&fields[29]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\013", "\000", "\000", "\000", "output_type"), UPB_TABVALUE_PTR_INIT(&fields[75]), NULL},
{UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[70]), NULL},
- {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
- {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL},
+ {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL},
+ {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[50]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[55]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[72]), &strentries[150]},
+ {UPB_TABKEY_STR("\007", "\000", "\000", "\000", "options"), UPB_TABVALUE_PTR_INIT(&fields[73]), &strentries[150]},
{UPB_TABKEY_STR("\006", "\000", "\000", "\000", "method"), UPB_TABVALUE_PTR_INIT(&fields[48]), NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[57]), &strentries[149]},
- {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
- {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[53]), &strentries[149]},
+ {UPB_TABKEY_STR("\024", "\000", "\000", "\000", "uninterpreted_option"), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
+ {UPB_TABKEY_STR("\012", "\000", "\000", "\000", "deprecated"), UPB_TABVALUE_PTR_INIT(&fields[15]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6860,15 +6735,15 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "span"), UPB_TABVALUE_PTR_INIT(&fields[87]), &strentries[167]},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "span"), UPB_TABVALUE_PTR_INIT(&fields[88]), &strentries[167]},
{UPB_TABKEY_STR("\031", "\000", "\000", "\000", "leading_detached_comments"), UPB_TABVALUE_PTR_INIT(&fields[43]), &strentries[165]},
- {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "trailing_comments"), UPB_TABVALUE_PTR_INIT(&fields[92]), NULL},
+ {UPB_TABKEY_STR("\021", "\000", "\000", "\000", "trailing_comments"), UPB_TABVALUE_PTR_INIT(&fields[93]), NULL},
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "leading_comments"), UPB_TABVALUE_PTR_INIT(&fields[42]), &strentries[164]},
{UPB_TABKEY_STR("\004", "\000", "\000", "\000", "path"), UPB_TABVALUE_PTR_INIT(&fields[78]), NULL},
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "double_value"), UPB_TABVALUE_PTR_INIT(&fields[16]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[51]), NULL},
+ {UPB_TABKEY_STR("\004", "\000", "\000", "\000", "name"), UPB_TABVALUE_PTR_INIT(&fields[49]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
@@ -6878,9 +6753,9 @@ static const upb_tabent strentries[236] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_STR("\022", "\000", "\000", "\000", "positive_int_value"), UPB_TABVALUE_PTR_INIT(&fields[79]), NULL},
+ {UPB_TABKEY_STR("\022", "\000", "\000", "\000", "positive_int_value"), UPB_TABVALUE_PTR_INIT(&fields[80]), NULL},
{UPB_TABKEY_STR("\020", "\000", "\000", "\000", "identifier_value"), UPB_TABVALUE_PTR_INIT(&fields[28]), NULL},
- {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "string_value"), UPB_TABVALUE_PTR_INIT(&fields[90]), &strentries[182]},
+ {UPB_TABKEY_STR("\014", "\000", "\000", "\000", "string_value"), UPB_TABVALUE_PTR_INIT(&fields[91]), &strentries[182]},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_STR("\014", "\000", "\000", "\000", "is_extension"), UPB_TABVALUE_PTR_INIT(&fields[30]), NULL},
@@ -6937,64 +6812,64 @@ static const upb_tabent strentries[236] = {
static const upb_tabent intentries[18] = {
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[102]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
{UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[99]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[95]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[97]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[11]), NULL},
+ {UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[10]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[100]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[96]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[14]), NULL},
+ {UPB_TABKEY_NUM(33), UPB_TABVALUE_PTR_INIT(&fields[15]), NULL},
{UPB_TABKEY_NONE, UPB_TABVALUE_EMPTY_INIT, NULL},
- {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[101]), NULL},
+ {UPB_TABKEY_NUM(999), UPB_TABVALUE_PTR_INIT(&fields[98]), NULL},
};
-static const upb_tabval arrays[184] = {
+static const upb_tabval arrays[186] = {
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[52]),
+ UPB_TABVALUE_PTR_INIT(&fields[50]),
UPB_TABVALUE_PTR_INIT(&fields[25]),
UPB_TABVALUE_PTR_INIT(&fields[60]),
- UPB_TABVALUE_PTR_INIT(&fields[19]),
+ UPB_TABVALUE_PTR_INIT(&fields[20]),
UPB_TABVALUE_PTR_INIT(&fields[24]),
UPB_TABVALUE_PTR_INIT(&fields[22]),
- UPB_TABVALUE_PTR_INIT(&fields[68]),
+ UPB_TABVALUE_PTR_INIT(&fields[69]),
UPB_TABVALUE_PTR_INIT(&fields[65]),
+ UPB_TABVALUE_PTR_INIT(&fields[84]),
UPB_TABVALUE_PTR_INIT(&fields[83]),
- UPB_TABVALUE_PTR_INIT(&fields[82]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[89]),
+ UPB_TABVALUE_PTR_INIT(&fields[90]),
UPB_TABVALUE_PTR_INIT(&fields[18]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[88]),
+ UPB_TABVALUE_PTR_INIT(&fields[89]),
UPB_TABVALUE_PTR_INIT(&fields[17]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[49]),
- UPB_TABVALUE_PTR_INIT(&fields[102]),
+ UPB_TABVALUE_PTR_INIT(&fields[54]),
+ UPB_TABVALUE_PTR_INIT(&fields[103]),
UPB_TABVALUE_PTR_INIT(&fields[74]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[1]),
- UPB_TABVALUE_PTR_INIT(&fields[13]),
+ UPB_TABVALUE_PTR_INIT(&fields[14]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[53]),
+ UPB_TABVALUE_PTR_INIT(&fields[51]),
UPB_TABVALUE_PTR_INIT(&fields[62]),
- UPB_TABVALUE_PTR_INIT(&fields[73]),
+ UPB_TABVALUE_PTR_INIT(&fields[72]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[15]),
+ UPB_TABVALUE_PTR_INIT(&fields[13]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[55]),
+ UPB_TABVALUE_PTR_INIT(&fields[56]),
UPB_TABVALUE_PTR_INIT(&fields[21]),
UPB_TABVALUE_PTR_INIT(&fields[63]),
UPB_TABVALUE_PTR_INIT(&fields[40]),
- UPB_TABVALUE_PTR_INIT(&fields[93]),
UPB_TABVALUE_PTR_INIT(&fields[94]),
+ UPB_TABVALUE_PTR_INIT(&fields[95]),
UPB_TABVALUE_PTR_INIT(&fields[7]),
UPB_TABVALUE_PTR_INIT(&fields[71]),
UPB_TABVALUE_PTR_INIT(&fields[66]),
@@ -7002,27 +6877,27 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[6]),
UPB_TABVALUE_PTR_INIT(&fields[77]),
- UPB_TABVALUE_PTR_INIT(&fields[10]),
+ UPB_TABVALUE_PTR_INIT(&fields[9]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[41]),
UPB_TABVALUE_PTR_INIT(&fields[39]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[103]),
+ UPB_TABVALUE_PTR_INIT(&fields[104]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[54]),
+ UPB_TABVALUE_PTR_INIT(&fields[57]),
UPB_TABVALUE_PTR_INIT(&fields[76]),
UPB_TABVALUE_PTR_INIT(&fields[8]),
UPB_TABVALUE_PTR_INIT(&fields[47]),
- UPB_TABVALUE_PTR_INIT(&fields[20]),
- UPB_TABVALUE_PTR_INIT(&fields[85]),
- UPB_TABVALUE_PTR_INIT(&fields[23]),
- UPB_TABVALUE_PTR_INIT(&fields[69]),
+ UPB_TABVALUE_PTR_INIT(&fields[19]),
UPB_TABVALUE_PTR_INIT(&fields[86]),
- UPB_TABVALUE_PTR_INIT(&fields[80]),
- UPB_TABVALUE_PTR_INIT(&fields[104]),
- UPB_TABVALUE_PTR_INIT(&fields[91]),
+ UPB_TABVALUE_PTR_INIT(&fields[23]),
+ UPB_TABVALUE_PTR_INIT(&fields[68]),
+ UPB_TABVALUE_PTR_INIT(&fields[87]),
+ UPB_TABVALUE_PTR_INIT(&fields[81]),
+ UPB_TABVALUE_PTR_INIT(&fields[105]),
+ UPB_TABVALUE_PTR_INIT(&fields[92]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[26]),
UPB_TABVALUE_EMPTY_INIT,
@@ -7043,7 +6918,7 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[3]),
UPB_TABVALUE_PTR_INIT(&fields[32]),
- UPB_TABVALUE_PTR_INIT(&fields[81]),
+ UPB_TABVALUE_PTR_INIT(&fields[82]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[31]),
UPB_TABVALUE_EMPTY_INIT,
@@ -7065,45 +6940,47 @@ static const upb_tabval arrays[184] = {
UPB_TABVALUE_PTR_INIT(&fields[5]),
UPB_TABVALUE_PTR_INIT(&fields[37]),
UPB_TABVALUE_EMPTY_INIT,
+ UPB_TABVALUE_PTR_INIT(&fields[79]),
+ UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[46]),
UPB_TABVALUE_PTR_INIT(&fields[61]),
- UPB_TABVALUE_PTR_INIT(&fields[9]),
+ UPB_TABVALUE_PTR_INIT(&fields[11]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[45]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[56]),
+ UPB_TABVALUE_PTR_INIT(&fields[52]),
UPB_TABVALUE_PTR_INIT(&fields[29]),
UPB_TABVALUE_PTR_INIT(&fields[75]),
UPB_TABVALUE_PTR_INIT(&fields[70]),
UPB_TABVALUE_PTR_INIT(&fields[4]),
- UPB_TABVALUE_PTR_INIT(&fields[84]),
+ UPB_TABVALUE_PTR_INIT(&fields[85]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[50]),
+ UPB_TABVALUE_PTR_INIT(&fields[55]),
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[57]),
+ UPB_TABVALUE_PTR_INIT(&fields[53]),
UPB_TABVALUE_PTR_INIT(&fields[48]),
- UPB_TABVALUE_PTR_INIT(&fields[72]),
+ UPB_TABVALUE_PTR_INIT(&fields[73]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[44]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[78]),
- UPB_TABVALUE_PTR_INIT(&fields[87]),
+ UPB_TABVALUE_PTR_INIT(&fields[88]),
UPB_TABVALUE_PTR_INIT(&fields[42]),
- UPB_TABVALUE_PTR_INIT(&fields[92]),
+ UPB_TABVALUE_PTR_INIT(&fields[93]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[43]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_EMPTY_INIT,
- UPB_TABVALUE_PTR_INIT(&fields[51]),
+ UPB_TABVALUE_PTR_INIT(&fields[49]),
UPB_TABVALUE_PTR_INIT(&fields[28]),
- UPB_TABVALUE_PTR_INIT(&fields[79]),
+ UPB_TABVALUE_PTR_INIT(&fields[80]),
UPB_TABVALUE_PTR_INIT(&fields[59]),
UPB_TABVALUE_PTR_INIT(&fields[16]),
- UPB_TABVALUE_PTR_INIT(&fields[90]),
+ UPB_TABVALUE_PTR_INIT(&fields[91]),
UPB_TABVALUE_PTR_INIT(&fields[0]),
UPB_TABVALUE_EMPTY_INIT,
UPB_TABVALUE_PTR_INIT(&fields[58]),
@@ -7144,7 +7021,9 @@ static const upb_tabval arrays[184] = {
};
#ifdef UPB_DEBUG_REFS
-static upb_inttable reftables[264] = {
+static upb_inttable reftables[266] = {
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
+ UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
UPB_EMPTY_INTTABLE_INIT(UPB_CTYPE_PTR),
@@ -7686,6 +7565,21 @@ static size_t file_onpackage(void *closure, const void *hd, const char *buf,
return n;
}
+static size_t file_onphpprefix(void *closure, const void *hd, const char *buf,
+ size_t n, const upb_bufhandle *handle) {
+ upb_descreader *r = closure;
+ char *prefix;
+ bool ok;
+ UPB_UNUSED(hd);
+ UPB_UNUSED(handle);
+
+ prefix = upb_gstrndup(buf, n);
+ ok = upb_filedef_setphpprefix(r->file, prefix, NULL);
+ upb_gfree(prefix);
+ UPB_ASSERT(ok);
+ return n;
+}
+
static size_t file_onsyntax(void *closure, const void *hd, const char *buf,
size_t n, const upb_bufhandle *handle) {
upb_descreader *r = closure;
@@ -8212,6 +8106,9 @@ static void reghandlers(const void *closure, upb_handlers *h) {
upb_handlers_setbool(h, F(FieldOptions, packed), &field_onpacked, NULL);
} else if (upbdefs_google_protobuf_MessageOptions_is(m)) {
upb_handlers_setbool(h, F(MessageOptions, map_entry), &msg_onmapentry, NULL);
+ } else if (upbdefs_google_protobuf_FileOptions_is(m)) {
+ upb_handlers_setstring(h, F(FileOptions, php_class_prefix),
+ &file_onphpprefix, NULL);
}
UPB_ASSERT(upb_ok(upb_handlers_status(h)));
@@ -10759,7 +10656,7 @@ static size_t encode_strbuf(void *c, const void *hd, const char *buf,
T(double, double, dbl2uint64, encode_fixed64)
T(float, float, flt2uint32, encode_fixed32)
T(int64, int64_t, uint64_t, encode_varint)
-T(int32, int32_t, uint32_t, encode_varint)
+T(int32, int32_t, int64_t, encode_varint)
T(fixed64, uint64_t, uint64_t, encode_fixed64)
T(fixed32, uint32_t, uint32_t, encode_fixed32)
T(bool, bool, bool, encode_varint)
diff --git a/php/ext/google/protobuf/upb.h b/php/ext/google/protobuf/upb.h
index 5f780458..78f255f9 100644
--- a/php/ext/google/protobuf/upb.h
+++ b/php/ext/google/protobuf/upb.h
@@ -2972,6 +2972,11 @@ class upb::FileDef {
const char* package() const;
bool set_package(const char* package, Status* s);
+ /* Sets the php class prefix which is prepended to all php generated classes
+ / from this .proto. Default is empty. */
+ const char* phpprefix() const;
+ bool set_phpprefix(const char* phpprefix, Status* s);
+
/* Syntax for the file. Defaults to proto2. */
upb_syntax_t syntax() const;
void set_syntax(upb_syntax_t syntax);
@@ -3025,6 +3030,7 @@ UPB_REFCOUNTED_CMETHODS(upb_filedef, upb_filedef_upcast)
const char *upb_filedef_name(const upb_filedef *f);
const char *upb_filedef_package(const upb_filedef *f);
+const char *upb_filedef_phpprefix(const upb_filedef *f);
upb_syntax_t upb_filedef_syntax(const upb_filedef *f);
size_t upb_filedef_defcount(const upb_filedef *f);
size_t upb_filedef_depcount(const upb_filedef *f);
@@ -3034,6 +3040,8 @@ const upb_filedef *upb_filedef_dep(const upb_filedef *f, size_t i);
bool upb_filedef_freeze(upb_filedef *f, upb_status *s);
bool upb_filedef_setname(upb_filedef *f, const char *name, upb_status *s);
bool upb_filedef_setpackage(upb_filedef *f, const char *package, upb_status *s);
+bool upb_filedef_setphpprefix(upb_filedef *f, const char *phpprefix,
+ upb_status *s);
bool upb_filedef_setsyntax(upb_filedef *f, upb_syntax_t syntax, upb_status *s);
bool upb_filedef_adddef(upb_filedef *f, upb_def *def, const void *ref_donor,
@@ -3792,6 +3800,12 @@ inline const char* FileDef::package() const {
inline bool FileDef::set_package(const char* package, Status* s) {
return upb_filedef_setpackage(this, package, s);
}
+inline const char* FileDef::phpprefix() const {
+ return upb_filedef_phpprefix(this);
+}
+inline bool FileDef::set_phpprefix(const char* phpprefix, Status* s) {
+ return upb_filedef_setphpprefix(this, phpprefix, s);
+}
inline int FileDef::def_count() const {
return upb_filedef_defcount(this);
}
@@ -4006,6 +4020,7 @@ struct upb_filedef {
const char *name;
const char *package;
+ const char *phpprefix;
upb_syntax_t syntax;
upb_inttable defs;
@@ -7212,6 +7227,7 @@ UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_java_string
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_javanano_use_deprecated_package(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 38); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_objc_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 36); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_optimize_for(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 9); }
+UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_php_class_prefix(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 40); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_py_generic_services(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 18); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_FileOptions_f_uninterpreted_option(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_FileOptions_is(m)); return upb_msgdef_itof(m, 999); }
UPB_INLINE const upb_fielddef *upbdefs_google_protobuf_MessageOptions_f_deprecated(const upb_msgdef *m) { UPB_ASSERT(upbdefs_google_protobuf_MessageOptions_is(m)); return upb_msgdef_itof(m, 3); }
diff --git a/php/generate_descriptor_protos.sh b/php/generate_descriptor_protos.sh
new file mode 100755
index 00000000..372ad69c
--- /dev/null
+++ b/php/generate_descriptor_protos.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+# Run this script to regenerate desriptor protos after the protocol compiler
+# changes.
+
+if test ! -e src/google/protobuf/stubs/common.h; then
+ cat >&2 << __EOF__
+Could not find source code. Make sure you are running this script from the
+root of the distribution tree.
+__EOF__
+ exit 1
+fi
+
+pushd src
+./protoc --php_out=internal:../php/src google/protobuf/descriptor.proto
+popd
diff --git a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
index 7c5c8df4..1b6b3d60 100644
--- a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
+++ b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php
@@ -144,6 +144,7 @@ class Descriptor
->optional('objc_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 36)
->optional('csharp_namespace', \Google\Protobuf\Internal\GPBType::STRING, 37)
->optional('swift_prefix', \Google\Protobuf\Internal\GPBType::STRING, 39)
+ ->optional('php_class_prefix', \Google\Protobuf\Internal\GPBType::STRING, 40)
->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption')
->finalizeToPool();
diff --git a/php/src/Google/Protobuf/Internal/DescriptorPool.php b/php/src/Google/Protobuf/Internal/DescriptorPool.php
index 23b304ac..1ef403cf 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorPool.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorPool.php
@@ -58,7 +58,7 @@ class DescriptorPool
public function internalAddGeneratedFile($data)
{
$files = new FileDescriptorSet();
- $files->decode($data);
+ $files->mergeFromString($data);
$file = FileDescriptor::buildFromProto($files->getFile()[0]);
foreach ($file->getMessageType() as &$desc) {
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php
index f076f6be..948c5876 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php
@@ -117,8 +117,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setField(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class);
- $this->field = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class);
+ $this->field = $arr;
$this->has_field = true;
}
@@ -140,8 +140,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setExtension(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class);
- $this->extension = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class);
+ $this->extension = $arr;
$this->has_extension = true;
}
@@ -163,8 +163,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setNestedType(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class);
- $this->nested_type = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class);
+ $this->nested_type = $arr;
$this->has_nested_type = true;
}
@@ -186,8 +186,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setEnumType(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class);
- $this->enum_type = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class);
+ $this->enum_type = $arr;
$this->has_enum_type = true;
}
@@ -209,8 +209,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setExtensionRange(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class);
- $this->extension_range = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class);
+ $this->extension_range = $arr;
$this->has_extension_range = true;
}
@@ -232,8 +232,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setOneofDecl(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class);
- $this->oneof_decl = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\OneofDescriptorProto::class);
+ $this->oneof_decl = $arr;
$this->has_oneof_decl = true;
}
@@ -278,8 +278,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setReservedRange(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class);
- $this->reserved_range = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class);
+ $this->reserved_range = $arr;
$this->has_reserved_range = true;
}
@@ -311,8 +311,8 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setReservedName(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
- $this->reserved_name = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->reserved_name = $arr;
$this->has_reserved_name = true;
}
diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
index 9c5f245b..73f6edbd 100644
--- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
@@ -77,8 +77,8 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setValue(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class);
- $this->value = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumValueDescriptorProto::class);
+ $this->value = $arr;
$this->has_value = true;
}
diff --git a/php/src/Google/Protobuf/Internal/EnumOptions.php b/php/src/Google/Protobuf/Internal/EnumOptions.php
index a9c4e0d7..4fa0bce7 100644
--- a/php/src/Google/Protobuf/Internal/EnumOptions.php
+++ b/php/src/Google/Protobuf/Internal/EnumOptions.php
@@ -144,8 +144,8 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/php/src/Google/Protobuf/Internal/EnumValueOptions.php
index 6446ecd4..232a6738 100644
--- a/php/src/Google/Protobuf/Internal/EnumValueOptions.php
+++ b/php/src/Google/Protobuf/Internal/EnumValueOptions.php
@@ -101,8 +101,8 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
index 06f26015..a3cd8ef9 100644
--- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
@@ -2,11 +2,11 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
+namespace Google\Protobuf\Internal;
+
/**
* Protobuf enum <code>google.protobuf.FieldDescriptorProto.Label</code>
*/
-namespace Google\Protobuf\Internal;
-
class FieldDescriptorProto_Label
{
/**
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
index 9bda76c2..8335f9b1 100644
--- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
@@ -2,11 +2,11 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
+namespace Google\Protobuf\Internal;
+
/**
* Protobuf enum <code>google.protobuf.FieldDescriptorProto.Type</code>
*/
-namespace Google\Protobuf\Internal;
-
class FieldDescriptorProto_Type
{
/**
@@ -63,6 +63,9 @@ class FieldDescriptorProto_Type
/**
* <pre>
* Tag-delimited aggregate.
+ * Group type is deprecated and not supported in proto3. However, Proto3
+ * implementations should still be able to parse the group wire format and
+ * treat group fields as unknown fields.
* </pre>
*
* <code>TYPE_GROUP = 10;</code>
diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php
index af1393a5..8db7ed67 100644
--- a/php/src/Google/Protobuf/Internal/FieldOptions.php
+++ b/php/src/Google/Protobuf/Internal/FieldOptions.php
@@ -415,8 +415,8 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
index 2ff2a478..f59f20be 100644
--- a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
+++ b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
@@ -2,11 +2,11 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
+namespace Google\Protobuf\Internal;
+
/**
* Protobuf enum <code>google.protobuf.FieldOptions.CType</code>
*/
-namespace Google\Protobuf\Internal;
-
class FieldOptions_CType
{
/**
diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
index 541c8ae5..0c6995b7 100644
--- a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
+++ b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
@@ -2,11 +2,11 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
+namespace Google\Protobuf\Internal;
+
/**
* Protobuf enum <code>google.protobuf.FieldOptions.JSType</code>
*/
-namespace Google\Protobuf\Internal;
-
class FieldOptions_JSType
{
/**
diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
index 39f67768..0363d9e9 100644
--- a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
@@ -206,8 +206,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setDependency(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
- $this->dependency = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->dependency = $arr;
$this->has_dependency = true;
}
@@ -237,8 +237,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setPublicDependency(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
- $this->public_dependency = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->public_dependency = $arr;
$this->has_public_dependency = true;
}
@@ -270,8 +270,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setWeakDependency(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
- $this->weak_dependency = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->weak_dependency = $arr;
$this->has_weak_dependency = true;
}
@@ -301,8 +301,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setMessageType(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class);
- $this->message_type = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\DescriptorProto::class);
+ $this->message_type = $arr;
$this->has_message_type = true;
}
@@ -324,8 +324,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setEnumType(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class);
- $this->enum_type = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\EnumDescriptorProto::class);
+ $this->enum_type = $arr;
$this->has_enum_type = true;
}
@@ -347,8 +347,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setService(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class);
- $this->service = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\ServiceDescriptorProto::class);
+ $this->service = $arr;
$this->has_service = true;
}
@@ -370,8 +370,8 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setExtension(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class);
- $this->extension = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FieldDescriptorProto::class);
+ $this->extension = $arr;
$this->has_extension = true;
}
diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php
index 20a165c4..0bcc8051 100644
--- a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php
+++ b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php
@@ -45,8 +45,8 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message
*/
public function setFile(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class);
- $this->file = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\FileDescriptorProto::class);
+ $this->file = $arr;
$this->has_file = true;
}
diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php
index 2422f3ee..22653a4f 100644
--- a/php/src/Google/Protobuf/Internal/FileOptions.php
+++ b/php/src/Google/Protobuf/Internal/FileOptions.php
@@ -178,6 +178,16 @@ class FileOptions extends \Google\Protobuf\Internal\Message
private $has_swift_prefix = false;
/**
* <pre>
+ * Sets the php class prefix which is prepended to all php generated classes
+ * from this .proto. Default is empty.
+ * </pre>
+ *
+ * <code>optional string php_class_prefix = 40;</code>
+ */
+ private $php_class_prefix = '';
+ private $has_php_class_prefix = false;
+ /**
+ * <pre>
* The parser stores options it doesn't recognize here. See above.
* </pre>
*
@@ -708,6 +718,39 @@ class FileOptions extends \Google\Protobuf\Internal\Message
/**
* <pre>
+ * Sets the php class prefix which is prepended to all php generated classes
+ * from this .proto. Default is empty.
+ * </pre>
+ *
+ * <code>optional string php_class_prefix = 40;</code>
+ */
+ public function getPhpClassPrefix()
+ {
+ return $this->php_class_prefix;
+ }
+
+ /**
+ * <pre>
+ * Sets the php class prefix which is prepended to all php generated classes
+ * from this .proto. Default is empty.
+ * </pre>
+ *
+ * <code>optional string php_class_prefix = 40;</code>
+ */
+ public function setPhpClassPrefix($var)
+ {
+ GPBUtil::checkString($var, True);
+ $this->php_class_prefix = $var;
+ $this->has_php_class_prefix = true;
+ }
+
+ public function hasPhpClassPrefix()
+ {
+ return $this->has_php_class_prefix;
+ }
+
+ /**
+ * <pre>
* The parser stores options it doesn't recognize here. See above.
* </pre>
*
@@ -727,8 +770,8 @@ class FileOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
index 7fd488eb..b550e7f1 100644
--- a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
+++ b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
@@ -2,6 +2,8 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
+namespace Google\Protobuf\Internal;
+
/**
* <pre>
* Generated classes can be optimized for speed or code size.
@@ -9,8 +11,6 @@
*
* Protobuf enum <code>google.protobuf.FileOptions.OptimizeMode</code>
*/
-namespace Google\Protobuf\Internal;
-
class FileOptions_OptimizeMode
{
/**
diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php
index ba1d2eb3..0e66ae6f 100644
--- a/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ b/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -34,6 +34,7 @@ namespace Google\Protobuf\Internal;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\MapField;
class GPBUtil
{
@@ -175,19 +176,60 @@ class GPBUtil
public static function checkRepeatedField(&$var, $type, $klass = null)
{
- if (!$var instanceof RepeatedField) {
- trigger_error("Expect repeated field.", E_USER_ERROR);
- }
- if ($var->getType() != $type) {
- trigger_error(
- "Expect repeated field of different type.",
- E_USER_ERROR);
- }
- if ($var->getType() === GPBType::MESSAGE &&
- $var->getClass() !== $klass) {
- trigger_error(
- "Expect repeated field of different message.",
- E_USER_ERROR);
+ if (!$var instanceof RepeatedField && !is_array($var)) {
+ trigger_error("Expect array.", E_USER_ERROR);
+ }
+ if (is_array($var)) {
+ $tmp = new RepeatedField($type, $klass);
+ foreach ($var as $value) {
+ $tmp[] = $value;
+ }
+ return $tmp;
+ } else {
+ if ($var->getType() != $type) {
+ trigger_error(
+ "Expect repeated field of different type.",
+ E_USER_ERROR);
+ }
+ if ($var->getType() === GPBType::MESSAGE &&
+ $var->getClass() !== $klass) {
+ trigger_error(
+ "Expect repeated field of different message.",
+ E_USER_ERROR);
+ }
+ return $var;
+ }
+ }
+
+ public static function checkMapField(&$var, $key_type, $value_type, $klass = null)
+ {
+ if (!$var instanceof MapField && !is_array($var)) {
+ trigger_error("Expect dict.", E_USER_ERROR);
+ }
+ if (is_array($var)) {
+ $tmp = new MapField($key_type, $value_type, $klass);
+ foreach ($var as $key => $value) {
+ $tmp[$key] = $value;
+ }
+ return $tmp;
+ } else {
+ if ($var->getKeyType() != $key_type) {
+ trigger_error(
+ "Expect map field of key type.",
+ E_USER_ERROR);
+ }
+ if ($var->getValueType() != $value_type) {
+ trigger_error(
+ "Expect map field of value type.",
+ E_USER_ERROR);
+ }
+ if ($var->getValueType() === GPBType::MESSAGE &&
+ $var->getValueClass() !== $klass) {
+ trigger_error(
+ "Expect map field of different value message.",
+ E_USER_ERROR);
+ }
+ return $var;
}
}
diff --git a/php/src/Google/Protobuf/Internal/GPBWire.php b/php/src/Google/Protobuf/Internal/GPBWire.php
index f75e0861..67eb1bee 100644
--- a/php/src/Google/Protobuf/Internal/GPBWire.php
+++ b/php/src/Google/Protobuf/Internal/GPBWire.php
@@ -403,10 +403,14 @@ class GPBWire
return self::varint32Size($tag);
}
- public static function varint32Size($value)
+ public static function varint32Size($value, $sign_extended = false)
{
if ($value < 0) {
- return 5;
+ if ($sign_extended) {
+ return 10;
+ } else {
+ return 5;
+ }
}
if ($value < (1 << 7)) {
return 1;
diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
index 8e493c2f..450854f1 100644
--- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
+++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
@@ -61,8 +61,8 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
*/
public function setAnnotation(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class);
- $this->annotation = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\GeneratedCodeInfo_Annotation::class);
+ $this->annotation = $arr;
$this->has_annotation = true;
}
diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
index dcc7edfe..ed22cc38 100644
--- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
+++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
@@ -85,8 +85,8 @@ class GeneratedCodeInfo_Annotation extends \Google\Protobuf\Internal\Message
*/
public function setPath(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
- $this->path = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->path = $arr;
$this->has_path = true;
}
diff --git a/php/src/Google/Protobuf/Internal/InputStream.php b/php/src/Google/Protobuf/Internal/InputStream.php
index bf052c2f..de5ca978 100644
--- a/php/src/Google/Protobuf/Internal/InputStream.php
+++ b/php/src/Google/Protobuf/Internal/InputStream.php
@@ -70,7 +70,6 @@ class InputStream
private $total_bytes_read;
const MAX_VARINT_BYTES = 10;
- const MAX_VARINT32_BYTES = 5;
const DEFAULT_RECURSION_LIMIT = 100;
const DEFAULT_TOTAL_BYTES_LIMIT = 33554432; // 32 << 20, 32MB
diff --git a/php/src/Google/Protobuf/Internal/MapField.php b/php/src/Google/Protobuf/Internal/MapField.php
index 14ee7ebe..68c10c08 100644
--- a/php/src/Google/Protobuf/Internal/MapField.php
+++ b/php/src/Google/Protobuf/Internal/MapField.php
@@ -204,6 +204,30 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
}
/**
+ * @ignore
+ */
+ public function getKeyType()
+ {
+ return $this->key_type;
+ }
+
+ /**
+ * @ignore
+ */
+ public function getValueType()
+ {
+ return $this->value_type;
+ }
+
+ /**
+ * @ignore
+ */
+ public function getValueClass()
+ {
+ return $this->klass;
+ }
+
+ /**
* Return the element at the given key.
*
* This will also be called for: $ele = $arr[$key]
diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php
index 17ef8536..887c86ca 100644
--- a/php/src/Google/Protobuf/Internal/Message.php
+++ b/php/src/Google/Protobuf/Internal/Message.php
@@ -562,12 +562,14 @@ class Message
* Parses a protocol buffer contained in a string.
*
* This function takes a string in the (non-human-readable) binary wire
- * format, matching the encoding output by encode().
+ * format, matching the encoding output by serializeToString().
+ * See mergeFrom() for merging behavior, if the field is already set in the
+ * specified message.
*
* @param string $data Binary protobuf data.
* @return bool Return true on success.
*/
- public function decode($data)
+ public function mergeFromString($data)
{
$input = new InputStream($data);
$this->parseFromStream($input);
@@ -714,7 +716,7 @@ class Message
* Serialize the message to string.
* @return string Serialized binary protobuf data.
*/
- public function encode()
+ public function serializeToString()
{
$output = new OutputStream($this->byteSize());
$this->serializeToStream($output);
@@ -770,9 +772,11 @@ class Message
case GPBType::SFIXED64:
$size += 8;
break;
- case GPBType::UINT32:
case GPBType::INT32:
case GPBType::ENUM:
+ $size += GPBWire::varint32Size($value, true);
+ break;
+ case GPBType::UINT32:
$size += GPBWire::varint32Size($value);
break;
case GPBType::UINT64:
diff --git a/php/src/Google/Protobuf/Internal/MessageOptions.php b/php/src/Google/Protobuf/Internal/MessageOptions.php
index e4a214cb..747f3294 100644
--- a/php/src/Google/Protobuf/Internal/MessageOptions.php
+++ b/php/src/Google/Protobuf/Internal/MessageOptions.php
@@ -320,8 +320,8 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/MethodOptions.php b/php/src/Google/Protobuf/Internal/MethodOptions.php
index 3325e52b..6dca5854 100644
--- a/php/src/Google/Protobuf/Internal/MethodOptions.php
+++ b/php/src/Google/Protobuf/Internal/MethodOptions.php
@@ -129,8 +129,8 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
index 62768b5c..ce4adfe7 100644
--- a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
+++ b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
@@ -2,6 +2,8 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/descriptor.proto
+namespace Google\Protobuf\Internal;
+
/**
* <pre>
* Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
@@ -11,8 +13,6 @@
*
* Protobuf enum <code>google.protobuf.MethodOptions.IdempotencyLevel</code>
*/
-namespace Google\Protobuf\Internal;
-
class MethodOptions_IdempotencyLevel
{
/**
diff --git a/php/src/Google/Protobuf/Internal/OneofOptions.php b/php/src/Google/Protobuf/Internal/OneofOptions.php
index 083d9929..b61325d2 100644
--- a/php/src/Google/Protobuf/Internal/OneofOptions.php
+++ b/php/src/Google/Protobuf/Internal/OneofOptions.php
@@ -52,8 +52,8 @@ class OneofOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/OutputStream.php b/php/src/Google/Protobuf/Internal/OutputStream.php
index 587ac352..8c6d9b68 100644
--- a/php/src/Google/Protobuf/Internal/OutputStream.php
+++ b/php/src/Google/Protobuf/Internal/OutputStream.php
@@ -39,7 +39,6 @@ class OutputStream
private $buffer_size;
private $current;
- const MAX_VARINT32_BYTES = 5;
const MAX_VARINT64_BYTES = 10;
public function __construct($size)
@@ -56,8 +55,8 @@ class OutputStream
public function writeVarint32($value)
{
- $bytes = str_repeat(chr(0), self::MAX_VARINT32_BYTES);
- $size = self::writeVarintToArray($value, $bytes, true);
+ $bytes = str_repeat(chr(0), self::MAX_VARINT64_BYTES);
+ $size = self::writeVarintToArray($value, $bytes);
return $this->writeRaw($bytes, $size);
}
@@ -102,20 +101,16 @@ class OutputStream
return true;
}
- private static function writeVarintToArray($value, &$buffer, $trim = false)
+ private static function writeVarintToArray($value, &$buffer)
{
$current = 0;
$high = 0;
$low = 0;
if (PHP_INT_SIZE == 4) {
- GPBUtil::divideInt64ToInt32($value, $high, $low, $trim);
+ GPBUtil::divideInt64ToInt32($value, $high, $low);
} else {
- if ($trim) {
- $low = $value & 0xFFFFFFFF;
- } else {
- $low = $value;
- }
+ $low = $value;
}
while ($low >= 0x80 || $low < 0) {
diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
index 624bde84..47776202 100644
--- a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
@@ -77,8 +77,8 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
*/
public function setMethod(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class);
- $this->method = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\MethodDescriptorProto::class);
+ $this->method = $arr;
$this->has_method = true;
}
diff --git a/php/src/Google/Protobuf/Internal/ServiceOptions.php b/php/src/Google/Protobuf/Internal/ServiceOptions.php
index 5f3564e4..62323dba 100644
--- a/php/src/Google/Protobuf/Internal/ServiceOptions.php
+++ b/php/src/Google/Protobuf/Internal/ServiceOptions.php
@@ -101,8 +101,8 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
*/
public function setUninterpretedOption(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
- $this->uninterpreted_option = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption::class);
+ $this->uninterpreted_option = $arr;
$this->has_uninterpreted_option = true;
}
diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
index d2352ddd..eab60880 100644
--- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
+++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php
@@ -177,8 +177,8 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
*/
public function setLocation(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class);
- $this->location = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\SourceCodeInfo_Location::class);
+ $this->location = $arr;
$this->has_location = true;
}
diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
index d1bdb166..5a02b26c 100644
--- a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
+++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
@@ -179,8 +179,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
*/
public function setPath(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
- $this->path = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->path = $arr;
$this->has_path = true;
}
@@ -218,8 +218,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
*/
public function setSpan(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
- $this->span = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32);
+ $this->span = $arr;
$this->has_span = true;
}
@@ -365,8 +365,8 @@ class SourceCodeInfo_Location extends \Google\Protobuf\Internal\Message
*/
public function setLeadingDetachedComments(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
- $this->leading_detached_comments = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
+ $this->leading_detached_comments = $arr;
$this->has_leading_detached_comments = true;
}
diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php
index c0f48310..28655019 100644
--- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php
+++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php
@@ -84,8 +84,8 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
*/
public function setName(&$var)
{
- GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class);
- $this->name = $var;
+ $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Internal\UninterpretedOption_NamePart::class);
+ $this->name = $arr;
$this->has_name = true;
}
diff --git a/php/src/Google/Protobuf/descriptor.php b/php/src/Google/Protobuf/descriptor.php
index 9e56ef27..2263af6e 100644
--- a/php/src/Google/Protobuf/descriptor.php
+++ b/php/src/Google/Protobuf/descriptor.php
@@ -78,14 +78,14 @@ class FileDescriptor
$file->setPackage($proto->getPackage());
foreach ($proto->getMessageType() as $message_proto) {
$file->addMessageType(Descriptor::buildFromProto(
- $message_proto, $file->getPackage(), ""));
+ $message_proto, $proto, ""));
}
foreach ($proto->getEnumType() as $enum_proto) {
$file->getEnumType()[] =
$file->addEnumType(
EnumDescriptor::buildFromProto(
$enum_proto,
- $file->getPackage(),
+ $proto,
""));
}
return $file;
@@ -182,7 +182,7 @@ class Descriptor
return $this->options;
}
- public static function buildFromProto($proto, $package, $containing)
+ public static function buildFromProto($proto, $file_proto, $containing)
{
$desc = new Descriptor();
@@ -192,7 +192,7 @@ class Descriptor
getFullClassName(
$proto,
$containing,
- $package,
+ $file_proto,
$message_name_without_package,
$classname,
$fullname);
@@ -207,7 +207,7 @@ class Descriptor
// Handle nested types.
foreach ($proto->getNestedType() as $nested_proto) {
$desc->addNestedType(Descriptor::buildFromProto(
- $nested_proto, $package, $message_name_without_package));
+ $nested_proto, $file_proto, $message_name_without_package));
}
// Handle oneof fields.
@@ -220,43 +220,46 @@ class Descriptor
}
}
-function addPrefixIfSpecial(
+function getClassNameWithoutPackage(
$name,
- $package)
+ $file_proto)
{
- if ($name === "Empty" && $package === "google.protobuf") {
+ if ($name === "Empty" && $file_proto->getPackage() === "google.protobuf") {
return "GPBEmpty";
} else {
- return $name;
+ $option = $file_proto->getOptions();
+ $prefix = is_null($option) ? "" : $option->getPhpClassPrefix();
+ // Nested message class names are seperated by '_', and package names
+ // are seperated by '\'.
+ return $prefix . implode('_', array_map('ucwords',
+ explode('.', $name)));
}
}
function getFullClassName(
$proto,
$containing,
- $package,
+ $file_proto,
&$message_name_without_package,
&$classname,
&$fullname)
{
// Full name needs to start with '.'.
- $message_name_without_package =
- addPrefixIfSpecial($proto->getName(), $package);
+ $message_name_without_package = $proto->getName();
if ($containing !== "") {
$message_name_without_package =
$containing . "." . $message_name_without_package;
}
+
+ $package = $file_proto->getPackage();
if ($package === "") {
$fullname = "." . $message_name_without_package;
} else {
$fullname = "." . $package . "." . $message_name_without_package;
}
- // Nested message class names are seperated by '_', and package names are
- // seperated by '\'.
$class_name_without_package =
- implode('_', array_map('ucwords',
- explode('.', $message_name_without_package)));
+ getClassNameWithoutPackage($message_name_without_package, $file_proto);
if ($package === "") {
$classname = $class_name_without_package;
} else {
@@ -333,7 +336,7 @@ class EnumDescriptor
return $this->klass;
}
- public static function buildFromProto($proto, $package, $containing)
+ public static function buildFromProto($proto, $file_proto, $containing)
{
$desc = new EnumDescriptor();
@@ -343,7 +346,7 @@ class EnumDescriptor
getFullClassName(
$proto,
$containing,
- $package,
+ $file_proto,
$enum_name_without_package,
$classname,
$fullname);
diff --git a/php/tests/encode_decode_test.php b/php/tests/encode_decode_test.php
index 3218aa63..94adf793 100644
--- a/php/tests/encode_decode_test.php
+++ b/php/tests/encode_decode_test.php
@@ -21,7 +21,7 @@ class EncodeDecodeTest extends TestBase
$this->setFields($from);
$this->expectFields($from);
- $data = $from->encode();
+ $data = $from->serializeToString();
$this->assertSame(bin2hex(TestUtil::getGoldenTestMessage()),
bin2hex($data));
}
@@ -29,7 +29,7 @@ class EncodeDecodeTest extends TestBase
public function testDecode()
{
$to = new TestMessage();
- $to->decode(TestUtil::getGoldenTestMessage());
+ $to->mergeFromString(TestUtil::getGoldenTestMessage());
$this->expectFields($to);
}
@@ -40,10 +40,10 @@ class EncodeDecodeTest extends TestBase
$this->setFields($from);
$this->expectFields($from);
- $data = $from->encode();
+ $data = $from->serializeToString();
$to = new TestMessage();
- $to->decode($data);
+ $to->mergeFromString($data);
$this->expectFields($to);
}
@@ -52,10 +52,10 @@ class EncodeDecodeTest extends TestBase
$from = new TestMessage();
$this->expectEmptyFields($from);
- $data = $from->encode();
+ $data = $from->serializeToString();
$to = new TestMessage();
- $to->decode($data);
+ $to->mergeFromString($data);
$this->expectEmptyFields($to);
}
@@ -64,29 +64,29 @@ class EncodeDecodeTest extends TestBase
$m = new TestMessage();
$m->setOneofInt32(1);
- $data = $m->encode();
+ $data = $m->serializeToString();
$n = new TestMessage();
- $n->decode($data);
+ $n->mergeFromString($data);
$this->assertSame(1, $n->getOneofInt32());
$m->setOneofFloat(2.0);
- $data = $m->encode();
+ $data = $m->serializeToString();
$n = new TestMessage();
- $n->decode($data);
+ $n->mergeFromString($data);
$this->assertSame(2.0, $n->getOneofFloat());
$m->setOneofString('abc');
- $data = $m->encode();
+ $data = $m->serializeToString();
$n = new TestMessage();
- $n->decode($data);
+ $n->mergeFromString($data);
$this->assertSame('abc', $n->getOneofString());
$sub_m = new TestMessage_Sub();
$sub_m->setA(1);
$m->setOneofMessage($sub_m);
- $data = $m->encode();
+ $data = $m->serializeToString();
$n = new TestMessage();
- $n->decode($data);
+ $n->mergeFromString($data);
$this->assertSame(1, $n->getOneofMessage()->getA());
}
@@ -95,20 +95,20 @@ class EncodeDecodeTest extends TestBase
$from = new TestPackedMessage();
TestUtil::setTestPackedMessage($from);
$this->assertSame(TestUtil::getGoldenTestPackedMessage(),
- $from->encode());
+ $from->serializeToString());
}
public function testPackedDecodePacked()
{
$to = new TestPackedMessage();
- $to->decode(TestUtil::getGoldenTestPackedMessage());
+ $to->mergeFromString(TestUtil::getGoldenTestPackedMessage());
TestUtil::assertTestPackedMessage($to);
}
public function testPackedDecodeUnpacked()
{
$to = new TestPackedMessage();
- $to->decode(TestUtil::getGoldenTestUnpackedMessage());
+ $to->mergeFromString(TestUtil::getGoldenTestUnpackedMessage());
TestUtil::assertTestPackedMessage($to);
}
@@ -117,20 +117,20 @@ class EncodeDecodeTest extends TestBase
$from = new TestUnpackedMessage();
TestUtil::setTestPackedMessage($from);
$this->assertSame(TestUtil::getGoldenTestUnpackedMessage(),
- $from->encode());
+ $from->serializeToString());
}
public function testUnpackedDecodePacked()
{
$to = new TestUnpackedMessage();
- $to->decode(TestUtil::getGoldenTestPackedMessage());
+ $to->mergeFromString(TestUtil::getGoldenTestPackedMessage());
TestUtil::assertTestPackedMessage($to);
}
public function testUnpackedDecodeUnpacked()
{
$to = new TestUnpackedMessage();
- $to->decode(TestUtil::getGoldenTestUnpackedMessage());
+ $to->mergeFromString(TestUtil::getGoldenTestUnpackedMessage());
TestUtil::assertTestPackedMessage($to);
}
@@ -161,19 +161,54 @@ class EncodeDecodeTest extends TestBase
$msg = new TestMessage();
foreach ($testVals as $original => $encoded) {
$msg->setOptionalInt64($original);
- $data = $msg->encode();
+ $data = $msg->serializeToString();
$this->assertSame($encoded, bin2hex($data));
$msg->setOptionalInt64(0);
- $msg->decode($data);
+ $msg->mergeFromString($data);
$this->assertEquals($original, $msg->getOptionalInt64());
}
}
+ public function testDecodeToExistingMessage()
+ {
+ $m1 = new TestMessage();
+ $this->setFields($m1);
+ $this->expectFields($m1);
+
+ $m2 = new TestMessage();
+ $this->setFields2($m2);
+ $data = $m2->serializeToString();
+
+ $m1->mergeFromString($data);
+ $this->expectFieldsMerged($m1);
+ }
+
public function testDecodeFieldNonExist()
{
$data = hex2bin('c80501');
$m = new TestMessage();
- $m->decode($data);
+ $m->mergeFromString($data);
+ }
+
+ public function testEncodeNegativeInt32()
+ {
+ $m = new TestMessage();
+ $m->setOptionalInt32(-1);
+ $data = $m->serializeToString();
+ $this->assertSame("08ffffffffffffffffff01", bin2hex($data));
+ }
+
+ public function testDecodeNegativeInt32()
+ {
+ $m = new TestMessage();
+ $this->assertEquals(0, $m->getOptionalInt32());
+ $m->mergeFromString(hex2bin("08ffffffffffffffffff01"));
+ $this->assertEquals(-1, $m->getOptionalInt32());
+
+ $m = new TestMessage();
+ $this->assertEquals(0, $m->getOptionalInt32());
+ $m->mergeFromString(hex2bin("08ffffffff0f"));
+ $this->assertEquals(-1, $m->getOptionalInt32());
}
# TODO(teboring): Add test back when php implementation is ready for json
diff --git a/php/tests/gdb_test.sh b/php/tests/gdb_test.sh
index 3c0d97a2..45a2841f 100755
--- a/php/tests/gdb_test.sh
+++ b/php/tests/gdb_test.sh
@@ -3,7 +3,7 @@
# gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which
# phpunit` --bootstrap autoload.php tmp_test.php
#
-gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php encode_decode_test.php
+gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so `which phpunit` --bootstrap autoload.php array_test.php
#
# # gdb --args php -dextension=../ext/google/protobuf/modules/protobuf.so
# memory_leak_test.php
diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php
index 7f8567b8..39e6c6c4 100644
--- a/php/tests/generated_class_test.php
+++ b/php/tests/generated_class_test.php
@@ -6,8 +6,10 @@ require_once('test_base.php');
require_once('test_util.php');
use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\MapField;
use Google\Protobuf\Internal\GPBType;
use Foo\TestEnum;
+use Foo\TestIncludePrefixMessage;
use Foo\TestMessage;
use Foo\TestMessage_Sub;
@@ -526,6 +528,26 @@ class GeneratedClassTest extends TestBase
$this->assertSame($repeated_int32, $m->getRepeatedInt32());
}
+ public function testRepeatedFieldViaArray()
+ {
+ $m = new TestMessage();
+
+ $arr = array();
+ $m->setRepeatedInt32($arr);
+ $this->assertSame(0, count($m->getRepeatedInt32()));
+
+ $arr = array(1, 2.1, "3");
+ $m->setRepeatedInt32($arr);
+ $this->assertTrue($m->getRepeatedInt32() instanceof RepeatedField);
+ $this->assertSame("Google\Protobuf\Internal\RepeatedField",
+ get_class($m->getRepeatedInt32()));
+ $this->assertSame(3, count($m->getRepeatedInt32()));
+ $this->assertSame(1, $m->getRepeatedInt32()[0]);
+ $this->assertSame(2, $m->getRepeatedInt32()[1]);
+ $this->assertSame(3, $m->getRepeatedInt32()[2]);
+ $this->assertFalse($arr instanceof RepeatedField);
+ }
+
/**
* @expectedException PHPUnit_Framework_Error
*/
@@ -569,6 +591,80 @@ class GeneratedClassTest extends TestBase
}
#########################################################
+ # Test map field.
+ #########################################################
+
+ public function testMapField()
+ {
+ $m = new TestMessage();
+
+ $map_int32_int32 = new MapField(GPBType::INT32, GPBType::INT32);
+ $m->setMapInt32Int32($map_int32_int32);
+ $this->assertSame($map_int32_int32, $m->getMapInt32Int32());
+ }
+
+ public function testMapFieldViaArray()
+ {
+ $m = new TestMessage();
+
+ $dict = array();
+ $m->setMapInt32Int32($dict);
+ $this->assertSame(0, count($m->getMapInt32Int32()));
+
+ $dict = array(5 => 5, 6.1 => 6.1, "7" => "7");
+ $m->setMapInt32Int32($dict);
+ $this->assertTrue($m->getMapInt32Int32() instanceof MapField);
+ $this->assertSame(3, count($m->getMapInt32Int32()));
+ $this->assertSame(5, $m->getMapInt32Int32()[5]);
+ $this->assertSame(6, $m->getMapInt32Int32()[6]);
+ $this->assertSame(7, $m->getMapInt32Int32()[7]);
+ $this->assertFalse($dict instanceof MapField);
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testMapFieldWrongTypeFail()
+ {
+ $m = new TestMessage();
+ $a = 1;
+ $m->setMapInt32Int32($a);
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testMapFieldWrongObjectFail()
+ {
+ $m = new TestMessage();
+ $m->setMapInt32Int32($m);
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testMapFieldWrongRepeatedTypeFail()
+ {
+ $m = new TestMessage();
+
+ $map_uint32_uint32 = new MapField(GPBType::UINT32, GPBType::UINT32);
+ $m->setMapInt32Int32($map_uint32_uint32);
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testMapFieldWrongRepeatedMessageClassFail()
+ {
+ $m = new TestMessage();
+
+ $map_int32_message = new MapField(GPBType::INT32,
+ GPBType::MESSAGE,
+ TestMessage::class);
+ $m->setMapInt32Message($map_int32_message);
+ }
+
+ #########################################################
# Test oneof field.
#########################################################
@@ -743,4 +839,17 @@ class GeneratedClassTest extends TestBase
{
$m = new NoNameSpaceEnum();
}
+
+ #########################################################
+ # Test message with given prefix.
+ #########################################################
+
+ public function testPrefixMessage()
+ {
+ $m = new TestIncludePrefixMessage();
+ $n = new PrefixTestPrefix();
+ $n->setA(1);
+ $m->setPrefixMessage($n);
+ $this->assertSame(1, $m->getPrefixMessage()->getA());
+ }
}
diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php
index d4776d6f..5dd79519 100644
--- a/php/tests/memory_leak_test.php
+++ b/php/tests/memory_leak_test.php
@@ -2,8 +2,10 @@
# phpunit has memory leak by itself. Thus, it cannot be used to test memory leak.
+require_once('generated/PrefixTestPrefix.php');
require_once('generated/Bar/TestInclude.php');
require_once('generated/Foo/TestEnum.php');
+require_once('generated/Foo/TestIncludePrefixMessage.php');
require_once('generated/Foo/TestMessage.php');
require_once('generated/Foo/TestMessage_Sub.php');
require_once('generated/Foo/TestPackedMessage.php');
@@ -11,6 +13,7 @@ require_once('generated/Foo/TestPhpDoc.php');
require_once('generated/Foo/TestUnpackedMessage.php');
require_once('generated/GPBMetadata/Proto/Test.php');
require_once('generated/GPBMetadata/Proto/TestInclude.php');
+require_once('generated/GPBMetadata/Proto/TestPrefix.php');
require_once('test_util.php');
use Google\Protobuf\Internal\RepeatedField;
@@ -22,10 +25,10 @@ $from = new TestMessage();
TestUtil::setTestMessage($from);
TestUtil::assertTestMessage($from);
-$data = $from->encode();
+$data = $from->serializeToString();
$to = new TestMessage();
-$to->decode($data);
+$to->mergeFromString($data);
TestUtil::assertTestMessage($to);
@@ -43,9 +46,9 @@ assert(1 === $m->getOneofInt32());
assert(0.0 === $m->getOneofFloat());
assert('' === $m->getOneofString());
assert(NULL === $m->getOneofMessage());
-$data = $m->encode();
+$data = $m->serializeToString();
$n = new TestMessage();
-$n->decode($data);
+$n->mergeFromString($data);
assert(1 === $n->getOneofInt32());
$m->setOneofFloat(2.0);
@@ -53,9 +56,9 @@ assert(0 === $m->getOneofInt32());
assert(2.0 === $m->getOneofFloat());
assert('' === $m->getOneofString());
assert(NULL === $m->getOneofMessage());
-$data = $m->encode();
+$data = $m->serializeToString();
$n = new TestMessage();
-$n->decode($data);
+$n->mergeFromString($data);
assert(2.0 === $n->getOneofFloat());
$m->setOneofString('abc');
@@ -63,9 +66,9 @@ assert(0 === $m->getOneofInt32());
assert(0.0 === $m->getOneofFloat());
assert('abc' === $m->getOneofString());
assert(NULL === $m->getOneofMessage());
-$data = $m->encode();
+$data = $m->serializeToString();
$n = new TestMessage();
-$n->decode($data);
+$n->mergeFromString($data);
assert('abc' === $n->getOneofString());
$sub_m = new TestMessage_Sub();
@@ -75,9 +78,9 @@ assert(0 === $m->getOneofInt32());
assert(0.0 === $m->getOneofFloat());
assert('' === $m->getOneofString());
assert(1 === $m->getOneofMessage()->getA());
-$data = $m->encode();
+$data = $m->serializeToString();
$n = new TestMessage();
-$n->decode($data);
+$n->mergeFromString($data);
assert(1 === $n->getOneofMessage()->getA());
$from = new TestMessage();
diff --git a/php/tests/php_implementation_test.php b/php/tests/php_implementation_test.php
index 00125db4..e1249808 100644
--- a/php/tests/php_implementation_test.php
+++ b/php/tests/php_implementation_test.php
@@ -290,14 +290,14 @@ class ImplementationTest extends TestBase
public function testDecode()
{
$m = new TestMessage();
- $m->decode(TestUtil::getGoldenTestMessage());
+ $m->mergeFromString(TestUtil::getGoldenTestMessage());
TestUtil::assertTestMessage($m);
}
public function testDescriptorDecode()
{
$file_desc_set = new FileDescriptorSet();
- $file_desc_set->decode(hex2bin(
+ $file_desc_set->mergeFromString(hex2bin(
"0a3b0a12746573745f696e636c7564652e70726f746f120362617222180a" .
"0b54657374496e636c75646512090a0161180120012805620670726f746f33"));
@@ -469,6 +469,11 @@ class ImplementationTest extends TestBase
$output = new OutputStream(3);
$output->writeVarint32(16384);
$this->assertSame(hex2bin('808001'), $output->getData());
+
+ // Negative numbers are padded to be compatible with int64.
+ $output = new OutputStream(10);
+ $output->writeVarint32(-43);
+ $this->assertSame(hex2bin('D5FFFFFFFFFFFFFFFF01'), $output->getData());
}
public function testWriteVarint64()
@@ -496,13 +501,13 @@ class ImplementationTest extends TestBase
{
$m = new TestMessage();
TestUtil::setTestMessage($m);
- $this->assertSame(481, $m->byteSize());
+ $this->assertSame(506, $m->byteSize());
}
public function testPackedByteSize()
{
$m = new TestPackedMessage();
TestUtil::setTestPackedMessage($m);
- $this->assertSame(156, $m->byteSize());
+ $this->assertSame(166, $m->byteSize());
}
}
diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto
index c971df21..1a47a3f2 100644
--- a/php/tests/proto/test.proto
+++ b/php/tests/proto/test.proto
@@ -1,6 +1,7 @@
syntax = "proto3";
import 'proto/test_include.proto';
+import 'proto/test_prefix.proto';
package foo;
@@ -100,6 +101,7 @@ message TestMessage {
enum TestEnum {
ZERO = 0;
ONE = 1;
+ TWO = 2;
}
message TestPackedMessage {
@@ -141,3 +143,7 @@ message TestUnpackedMessage {
message TestPhpDoc {
int32 a = 1;
}
+
+message TestIncludePrefixMessage {
+ TestPrefix prefix_message = 1;
+}
diff --git a/php/tests/proto/test_prefix.proto b/php/tests/proto/test_prefix.proto
new file mode 100644
index 00000000..04582121
--- /dev/null
+++ b/php/tests/proto/test_prefix.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+option php_class_prefix = "Prefix";
+
+message TestPrefix {
+ int32 a = 1;
+}
diff --git a/php/tests/test_base.php b/php/tests/test_base.php
index 729fea3b..67048f4c 100644
--- a/php/tests/test_base.php
+++ b/php/tests/test_base.php
@@ -12,6 +12,11 @@ class TestBase extends PHPUnit_Framework_TestCase
TestUtil::setTestMessage($m);
}
+ public function setFields2(TestMessage $m)
+ {
+ TestUtil::setTestMessage2($m);
+ }
+
public function expectFields(TestMessage $m)
{
$this->assertSame(-44, $m->getOptionalSint32());
@@ -98,6 +103,139 @@ class TestBase extends PHPUnit_Framework_TestCase
$this->assertEquals(36, $m->getMapInt32Message()[1]->GetA());
}
+ // Test message merged from setFields and setFields2.
+ public function expectFieldsMerged(TestMessage $m)
+ {
+ $this->assertSame(-144, $m->getOptionalSint32());
+ $this->assertSame(146, $m->getOptionalFixed32());
+ $this->assertSame(-146, $m->getOptionalSfixed32());
+ $this->assertSame(11.5, $m->getOptionalFloat());
+ $this->assertSame(11.6, $m->getOptionalDouble());
+ $this->assertSame(true, $m->getOptionalBool());
+ $this->assertSame('aa', $m->getOptionalString());
+ $this->assertSame('bb', $m->getOptionalBytes());
+ $this->assertSame(133, $m->getOptionalMessage()->getA());
+ if (PHP_INT_SIZE == 4) {
+ $this->assertSame('-143', $m->getOptionalInt64());
+ $this->assertSame('143', $m->getOptionalUint64());
+ $this->assertSame('-145', $m->getOptionalSint64());
+ $this->assertSame('147', $m->getOptionalFixed64());
+ $this->assertSame('-147', $m->getOptionalSfixed64());
+ } else {
+ $this->assertSame(-143, $m->getOptionalInt64());
+ $this->assertSame(143, $m->getOptionalUint64());
+ $this->assertSame(-145, $m->getOptionalSint64());
+ $this->assertSame(147, $m->getOptionalFixed64());
+ $this->assertSame(-147, $m->getOptionalSfixed64());
+ }
+
+ $this->assertEquals(-42, $m->getRepeatedInt32()[0]);
+ $this->assertEquals(42, $m->getRepeatedUint32()[0]);
+ $this->assertEquals(-43, $m->getRepeatedInt64()[0]);
+ $this->assertEquals(43, $m->getRepeatedUint64()[0]);
+ $this->assertEquals(-44, $m->getRepeatedSint32()[0]);
+ $this->assertEquals(-45, $m->getRepeatedSint64()[0]);
+ $this->assertEquals(46, $m->getRepeatedFixed32()[0]);
+ $this->assertEquals(47, $m->getRepeatedFixed64()[0]);
+ $this->assertEquals(-46, $m->getRepeatedSfixed32()[0]);
+ $this->assertEquals(-47, $m->getRepeatedSfixed64()[0]);
+ $this->assertEquals(1.5, $m->getRepeatedFloat()[0]);
+ $this->assertEquals(1.6, $m->getRepeatedDouble()[0]);
+ $this->assertEquals(true, $m->getRepeatedBool()[0]);
+ $this->assertEquals('a', $m->getRepeatedString()[0]);
+ $this->assertEquals('b', $m->getRepeatedBytes()[0]);
+ $this->assertEquals(TestEnum::ZERO, $m->getRepeatedEnum()[0]);
+ $this->assertEquals(34, $m->getRepeatedMessage()[0]->GetA());
+
+ $this->assertEquals(-52, $m->getRepeatedInt32()[1]);
+ $this->assertEquals(52, $m->getRepeatedUint32()[1]);
+ $this->assertEquals(-53, $m->getRepeatedInt64()[1]);
+ $this->assertEquals(53, $m->getRepeatedUint64()[1]);
+ $this->assertEquals(-54, $m->getRepeatedSint32()[1]);
+ $this->assertEquals(-55, $m->getRepeatedSint64()[1]);
+ $this->assertEquals(56, $m->getRepeatedFixed32()[1]);
+ $this->assertEquals(57, $m->getRepeatedFixed64()[1]);
+ $this->assertEquals(-56, $m->getRepeatedSfixed32()[1]);
+ $this->assertEquals(-57, $m->getRepeatedSfixed64()[1]);
+ $this->assertEquals(2.5, $m->getRepeatedFloat()[1]);
+ $this->assertEquals(2.6, $m->getRepeatedDouble()[1]);
+ $this->assertEquals(false, $m->getRepeatedBool()[1]);
+ $this->assertEquals('c', $m->getRepeatedString()[1]);
+ $this->assertEquals('d', $m->getRepeatedBytes()[1]);
+ $this->assertEquals(TestEnum::ONE, $m->getRepeatedEnum()[1]);
+ $this->assertEquals(35, $m->getRepeatedMessage()[1]->GetA());
+
+ $this->assertEquals(-142, $m->getRepeatedInt32()[2]);
+ $this->assertEquals(142, $m->getRepeatedUint32()[2]);
+ $this->assertEquals(-143, $m->getRepeatedInt64()[2]);
+ $this->assertEquals(143, $m->getRepeatedUint64()[2]);
+ $this->assertEquals(-144, $m->getRepeatedSint32()[2]);
+ $this->assertEquals(-145, $m->getRepeatedSint64()[2]);
+ $this->assertEquals(146, $m->getRepeatedFixed32()[2]);
+ $this->assertEquals(147, $m->getRepeatedFixed64()[2]);
+ $this->assertEquals(-146, $m->getRepeatedSfixed32()[2]);
+ $this->assertEquals(-147, $m->getRepeatedSfixed64()[2]);
+ $this->assertEquals(11.5, $m->getRepeatedFloat()[2]);
+ $this->assertEquals(11.6, $m->getRepeatedDouble()[2]);
+ $this->assertEquals(false, $m->getRepeatedBool()[2]);
+ $this->assertEquals('aa', $m->getRepeatedString()[2]);
+ $this->assertEquals('bb', $m->getRepeatedBytes()[2]);
+ $this->assertEquals(TestEnum::TWO, $m->getRepeatedEnum()[2]);
+ $this->assertEquals(134, $m->getRepeatedMessage()[2]->GetA());
+
+ if (PHP_INT_SIZE == 4) {
+ $this->assertEquals('-163', $m->getMapInt64Int64()['-63']);
+ $this->assertEquals('163', $m->getMapUint64Uint64()['63']);
+ $this->assertEquals('-165', $m->getMapSint64Sint64()['-65']);
+ $this->assertEquals('167', $m->getMapFixed64Fixed64()['67']);
+ $this->assertEquals('-169', $m->getMapSfixed64Sfixed64()['-69']);
+ } else {
+ $this->assertEquals(-163, $m->getMapInt64Int64()[-63]);
+ $this->assertEquals(163, $m->getMapUint64Uint64()[63]);
+ $this->assertEquals(-165, $m->getMapSint64Sint64()[-65]);
+ $this->assertEquals(167, $m->getMapFixed64Fixed64()[67]);
+ $this->assertEquals(-169, $m->getMapSfixed64Sfixed64()[-69]);
+ }
+ $this->assertEquals(-162, $m->getMapInt32Int32()[-62]);
+ $this->assertEquals(162, $m->getMapUint32Uint32()[62]);
+ $this->assertEquals(-164, $m->getMapSint32Sint32()[-64]);
+ $this->assertEquals(166, $m->getMapFixed32Fixed32()[66]);
+ $this->assertEquals(-168, $m->getMapSfixed32Sfixed32()[-68]);
+ $this->assertEquals(13.5, $m->getMapInt32Float()[1]);
+ $this->assertEquals(13.6, $m->getMapInt32Double()[1]);
+ $this->assertEquals(false , $m->getMapBoolBool()[true]);
+ $this->assertEquals('ee', $m->getMapStringString()['e']);
+ $this->assertEquals('ff', $m->getMapInt32Bytes()[1]);
+ $this->assertEquals(TestEnum::TWO, $m->getMapInt32Enum()[1]);
+ $this->assertEquals(136, $m->getMapInt32Message()[1]->GetA());
+
+ if (PHP_INT_SIZE == 4) {
+ $this->assertEquals('-163', $m->getMapInt64Int64()['-163']);
+ $this->assertEquals('163', $m->getMapUint64Uint64()['163']);
+ $this->assertEquals('-165', $m->getMapSint64Sint64()['-165']);
+ $this->assertEquals('167', $m->getMapFixed64Fixed64()['167']);
+ $this->assertEquals('-169', $m->getMapSfixed64Sfixed64()['-169']);
+ } else {
+ $this->assertEquals(-163, $m->getMapInt64Int64()[-163]);
+ $this->assertEquals(163, $m->getMapUint64Uint64()[163]);
+ $this->assertEquals(-165, $m->getMapSint64Sint64()[-165]);
+ $this->assertEquals(167, $m->getMapFixed64Fixed64()[167]);
+ $this->assertEquals(-169, $m->getMapSfixed64Sfixed64()[-169]);
+ }
+ $this->assertEquals(-162, $m->getMapInt32Int32()[-162]);
+ $this->assertEquals(162, $m->getMapUint32Uint32()[162]);
+ $this->assertEquals(-164, $m->getMapSint32Sint32()[-164]);
+ $this->assertEquals(166, $m->getMapFixed32Fixed32()[166]);
+ $this->assertEquals(-168, $m->getMapSfixed32Sfixed32()[-168]);
+ $this->assertEquals(13.5, $m->getMapInt32Float()[2]);
+ $this->assertEquals(13.6, $m->getMapInt32Double()[2]);
+ $this->assertEquals(false , $m->getMapBoolBool()[false]);
+ $this->assertEquals('ee', $m->getMapStringString()['ee']);
+ $this->assertEquals('ff', $m->getMapInt32Bytes()[2]);
+ $this->assertEquals(TestEnum::TWO, $m->getMapInt32Enum()[2]);
+ $this->assertEquals(136, $m->getMapInt32Message()[2]->GetA());
+ }
+
public function expectEmptyFields(TestMessage $m)
{
$this->assertSame(0, $m->getOptionalInt32());
diff --git a/php/tests/test_util.php b/php/tests/test_util.php
index b7db5c1d..61f94aa1 100644
--- a/php/tests/test_util.php
+++ b/php/tests/test_util.php
@@ -130,6 +130,87 @@ class TestUtil
$m->getMapInt32Message()[1]->SetA(36);
}
+ public static function setTestMessage2(TestMessage $m)
+ {
+ $sub = new TestMessage_Sub();
+
+ $m->setOptionalInt32(-142);
+ $m->setOptionalInt64(-143);
+ $m->setOptionalUint32(142);
+ $m->setOptionalUint64(143);
+ $m->setOptionalSint32(-144);
+ $m->setOptionalSint64(-145);
+ $m->setOptionalFixed32(146);
+ $m->setOptionalFixed64(147);
+ $m->setOptionalSfixed32(-146);
+ $m->setOptionalSfixed64(-147);
+ $m->setOptionalFloat(11.5);
+ $m->setOptionalDouble(11.6);
+ $m->setOptionalBool(true);
+ $m->setOptionalString('aa');
+ $m->setOptionalBytes('bb');
+ $m->setOptionalEnum(TestEnum::TWO);
+ $m->setOptionalMessage($sub);
+ $m->getOptionalMessage()->SetA(133);
+
+ $m->getRepeatedInt32() []= -142;
+ $m->getRepeatedInt64() []= -143;
+ $m->getRepeatedUint32() []= 142;
+ $m->getRepeatedUint64() []= 143;
+ $m->getRepeatedSint32() []= -144;
+ $m->getRepeatedSint64() []= -145;
+ $m->getRepeatedFixed32() []= 146;
+ $m->getRepeatedFixed64() []= 147;
+ $m->getRepeatedSfixed32() []= -146;
+ $m->getRepeatedSfixed64() []= -147;
+ $m->getRepeatedFloat() []= 11.5;
+ $m->getRepeatedDouble() []= 11.6;
+ $m->getRepeatedBool() []= false;
+ $m->getRepeatedString() []= 'aa';
+ $m->getRepeatedBytes() []= 'bb';
+ $m->getRepeatedEnum() []= TestEnum::TWO;
+ $m->getRepeatedMessage() []= new TestMessage_Sub();
+ $m->getRepeatedMessage()[0]->setA(134);
+
+ $m->getMapInt32Int32()[-62] = -162;
+ $m->getMapInt64Int64()[-63] = -163;
+ $m->getMapUint32Uint32()[62] = 162;
+ $m->getMapUint64Uint64()[63] = 163;
+ $m->getMapSint32Sint32()[-64] = -164;
+ $m->getMapSint64Sint64()[-65] = -165;
+ $m->getMapFixed32Fixed32()[66] = 166;
+ $m->getMapFixed64Fixed64()[67] = 167;
+ $m->getMapSfixed32Sfixed32()[-68] = -168;
+ $m->getMapSfixed64Sfixed64()[-69] = -169;
+ $m->getMapInt32Float()[1] = 13.5;
+ $m->getMapInt32Double()[1] = 13.6;
+ $m->getMapBoolBool()[true] = false;
+ $m->getMapStringString()['e'] = 'ee';
+ $m->getMapInt32Bytes()[1] = 'ff';
+ $m->getMapInt32Enum()[1] = TestEnum::TWO;
+ $m->getMapInt32Message()[1] = new TestMessage_Sub();
+ $m->getMapInt32Message()[1]->SetA(136);
+
+ $m->getMapInt32Int32()[-162] = -162;
+ $m->getMapInt64Int64()[-163] = -163;
+ $m->getMapUint32Uint32()[162] = 162;
+ $m->getMapUint64Uint64()[163] = 163;
+ $m->getMapSint32Sint32()[-164] = -164;
+ $m->getMapSint64Sint64()[-165] = -165;
+ $m->getMapFixed32Fixed32()[166] = 166;
+ $m->getMapFixed64Fixed64()[167] = 167;
+ $m->getMapSfixed32Sfixed32()[-168] = -168;
+ $m->getMapSfixed64Sfixed64()[-169] = -169;
+ $m->getMapInt32Float()[2] = 13.5;
+ $m->getMapInt32Double()[2] = 13.6;
+ $m->getMapBoolBool()[false] = false;
+ $m->getMapStringString()['ee'] = 'ee';
+ $m->getMapInt32Bytes()[2] = 'ff';
+ $m->getMapInt32Enum()[2] = TestEnum::TWO;
+ $m->getMapInt32Message()[2] = new TestMessage_Sub();
+ $m->getMapInt32Message()[2]->SetA(136);
+ }
+
public static function assertTestMessage(TestMessage $m)
{
if (PHP_INT_SIZE == 4) {
@@ -240,7 +321,7 @@ class TestUtil
public static function getGoldenTestMessage()
{
return hex2bin(
- "08D6FFFFFF0F" .
+ "08D6FFFFFFFFFFFFFFFF01" .
"10D5FFFFFFFFFFFFFFFF01" .
"182A" .
"202B" .
@@ -258,8 +339,8 @@ class TestUtil
"800101" .
"8A01020821" .
- "F801D6FFFFFF0F" .
- "F801CCFFFFFF0F" .
+ "F801D6FFFFFFFFFFFFFFFF01" .
+ "F801CCFFFFFFFFFFFFFFFF01" .
"8002D5FFFFFFFFFFFFFFFF01" .
"8002CBFFFFFFFFFFFFFFFF01" .
"88022A" .
@@ -293,7 +374,7 @@ class TestUtil
"FA02020822" .
"FA02020823" .
- "BA040C08C2FFFFFF0F10C2FFFFFF0F" .
+ "BA041608C2FFFFFFFFFFFFFFFF0110C2FFFFFFFFFFFFFFFF01" .
"C2041608C1FFFFFFFFFFFFFFFF0110C1FFFFFFFFFFFFFFFF01" .
"CA0404083E103E" .
"D20404083F103F" .
@@ -408,7 +489,7 @@ class TestUtil
public static function getGoldenTestPackedMessage()
{
return hex2bin(
- "D2050AD6FFFFFF0FCCFFFFFF0F" .
+ "D20514D6FFFFFFFFFFFFFFFF01CCFFFFFFFFFFFFFFFF01" .
"DA0514D5FFFFFFFFFFFFFFFF01CBFFFFFFFFFFFFFFFF01" .
"E205022A34" .
"EA05022B35" .
@@ -428,7 +509,7 @@ class TestUtil
public static function getGoldenTestUnpackedMessage()
{
return hex2bin(
- "D005D6FFFFFF0FD005CCFFFFFF0F" .
+ "D005D6FFFFFFFFFFFFFFFF01D005CCFFFFFFFFFFFFFFFF01" .
"D805D5FFFFFFFFFFFFFFFF01D805CBFFFFFFFFFFFFFFFF01" .
"E0052AE00534" .
"E8052BE80535" .