Unverified Commit f50204da authored by Paul Yang's avatar Paul Yang Committed by GitHub

Initialize well known type values (#6713) (#6714)

* Initialize well known type values

Also fixes #6667

* Revert unwanted change
parent 3f323c5b
...@@ -1770,19 +1770,19 @@ zend_class_entry* api_type; ...@@ -1770,19 +1770,19 @@ zend_class_entry* api_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Api", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Api",
Api, api) Api, api)
zend_declare_property_null(api_type, "name", strlen("name"), zend_declare_property_string(api_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(api_type, "methods", strlen("methods"), zend_declare_property_null(api_type, "methods", strlen("methods"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(api_type, "options", strlen("options"), zend_declare_property_null(api_type, "options", strlen("options"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(api_type, "version", strlen("version"), zend_declare_property_string(api_type, "version", strlen("version"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(api_type, "source_context", strlen("source_context"), zend_declare_property_null(api_type, "source_context", strlen("source_context"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(api_type, "mixins", strlen("mixins"), zend_declare_property_null(api_type, "mixins", strlen("mixins"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(api_type, "syntax", strlen("syntax"), zend_declare_property_long(api_type, "syntax", strlen("syntax"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -1816,7 +1816,7 @@ zend_class_entry* bool_value_type; ...@@ -1816,7 +1816,7 @@ zend_class_entry* bool_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BoolValue", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BoolValue",
BoolValue, bool_value) BoolValue, bool_value)
zend_declare_property_null(bool_value_type, "value", strlen("value"), zend_declare_property_bool(bool_value_type, "value", strlen("value"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -1844,8 +1844,8 @@ zend_class_entry* bytes_value_type; ...@@ -1844,8 +1844,8 @@ zend_class_entry* bytes_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BytesValue", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\BytesValue",
BytesValue, bytes_value) BytesValue, bytes_value)
zend_declare_property_null(bytes_value_type, "value", strlen("value"), zend_declare_property_string(bytes_value_type, "value", strlen("value"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(BytesValue, __construct) { PHP_METHOD(BytesValue, __construct) {
...@@ -1872,8 +1872,8 @@ zend_class_entry* double_value_type; ...@@ -1872,8 +1872,8 @@ zend_class_entry* double_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\DoubleValue", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\DoubleValue",
DoubleValue, double_value) DoubleValue, double_value)
zend_declare_property_null(double_value_type, "value", strlen("value"), zend_declare_property_double(double_value_type, "value", strlen("value"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(DoubleValue, __construct) { PHP_METHOD(DoubleValue, __construct) {
...@@ -1908,15 +1908,15 @@ zend_class_entry* enum_type; ...@@ -1908,15 +1908,15 @@ zend_class_entry* enum_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Enum", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Enum",
Enum, enum) Enum, enum)
zend_declare_property_null(enum_type, "name", strlen("name"), zend_declare_property_string(enum_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(enum_type, "enumvalue", strlen("enumvalue"), zend_declare_property_null(enum_type, "enumvalue", strlen("enumvalue"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(enum_type, "options", strlen("options"), zend_declare_property_null(enum_type, "options", strlen("options"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(enum_type, "source_context", strlen("source_context"), zend_declare_property_null(enum_type, "source_context", strlen("source_context"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(enum_type, "syntax", strlen("syntax"), zend_declare_property_long(enum_type, "syntax", strlen("syntax"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -1952,9 +1952,9 @@ zend_class_entry* enum_value_type; ...@@ -1952,9 +1952,9 @@ zend_class_entry* enum_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\EnumValue", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\EnumValue",
EnumValue, enum_value) EnumValue, enum_value)
zend_declare_property_null(enum_value_type, "name", strlen("name"), zend_declare_property_string(enum_value_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(enum_value_type, "number", strlen("number"), zend_declare_property_long(enum_value_type, "number", strlen("number"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(enum_value_type, "options", strlen("options"), zend_declare_property_null(enum_value_type, "options", strlen("options"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
...@@ -2032,26 +2032,27 @@ zend_class_entry* field_type; ...@@ -2032,26 +2032,27 @@ zend_class_entry* field_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Field", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Field",
Field, field) Field, field)
zend_declare_property_null(field_type, "kind", strlen("kind"), zend_declare_property_long(field_type, "kind", strlen("kind"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "cardinality", strlen("cardinality"), zend_declare_property_long(field_type, "cardinality", strlen("cardinality"),
0, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_long(field_type, "number", strlen("number"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "number", strlen("number"), zend_declare_property_string(field_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "name", strlen("name"), zend_declare_property_string(field_type, "type_url", strlen("type_url"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "type_url", strlen("type_url"), zend_declare_property_long(field_type, "oneof_index", strlen("oneof_index"),
ZEND_ACC_PRIVATE TSRMLS_CC); 0, ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "oneof_index", strlen("oneof_index"), zend_declare_property_bool(field_type, "packed", strlen("packed"), false,
ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "packed", strlen("packed"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "options", strlen("options"), zend_declare_property_null(field_type, "options", strlen("options"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "json_name", strlen("json_name"), zend_declare_property_string(field_type, "json_name", strlen("json_name"),
ZEND_ACC_PRIVATE TSRMLS_CC); "", ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(field_type, "default_value", strlen("default_value"), zend_declare_property_string(field_type, "default_value",
ZEND_ACC_PRIVATE TSRMLS_CC); strlen("default_value"), "",
ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(Field, __construct) { PHP_METHOD(Field, __construct) {
...@@ -2087,8 +2088,8 @@ zend_class_entry* float_value_type; ...@@ -2087,8 +2088,8 @@ zend_class_entry* float_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\FloatValue", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\FloatValue",
FloatValue, float_value) FloatValue, float_value)
zend_declare_property_null(float_value_type, "value", strlen("value"), zend_declare_property_double(float_value_type, "value", strlen("value"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(FloatValue, __construct) { PHP_METHOD(FloatValue, __construct) {
...@@ -2138,7 +2139,7 @@ zend_class_entry* int32_value_type; ...@@ -2138,7 +2139,7 @@ zend_class_entry* int32_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int32Value", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int32Value",
Int32Value, int32_value) Int32Value, int32_value)
zend_declare_property_null(int32_value_type, "value", strlen("value"), zend_declare_property_long(int32_value_type, "value", strlen("value"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -2166,7 +2167,7 @@ zend_class_entry* int64_value_type; ...@@ -2166,7 +2167,7 @@ zend_class_entry* int64_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int64Value", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Int64Value",
Int64Value, int64_value) Int64Value, int64_value)
zend_declare_property_null(int64_value_type, "value", strlen("value"), zend_declare_property_long(int64_value_type, "value", strlen("value"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -2234,19 +2235,23 @@ zend_class_entry* method_type; ...@@ -2234,19 +2235,23 @@ zend_class_entry* method_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Method", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Method",
Method, method) Method, method)
zend_declare_property_null(method_type, "name", strlen("name"), zend_declare_property_string(method_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(method_type, "request_type_url", strlen("request_type_url"), zend_declare_property_string(method_type, "request_type_url",
ZEND_ACC_PRIVATE TSRMLS_CC); strlen("request_type_url"), "",
zend_declare_property_null(method_type, "request_streaming", strlen("request_streaming"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_bool(method_type, "request_streaming",
strlen("request_streaming"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(method_type, "response_type_url", strlen("response_type_url"), zend_declare_property_string(method_type, "response_type_url",
ZEND_ACC_PRIVATE TSRMLS_CC); strlen("response_type_url"), "",
zend_declare_property_null(method_type, "response_streaming", strlen("response_streaming"), ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_bool(method_type, "response_streaming",
strlen("response_streaming"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(method_type, "options", strlen("options"), zend_declare_property_null(method_type, "options", strlen("options"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(method_type, "syntax", strlen("syntax"), zend_declare_property_long(method_type, "syntax", strlen("syntax"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -2282,10 +2287,10 @@ zend_class_entry* mixin_type; ...@@ -2282,10 +2287,10 @@ zend_class_entry* mixin_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Mixin", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Mixin",
Mixin, mixin) Mixin, mixin)
zend_declare_property_null(mixin_type, "name", strlen("name"), zend_declare_property_string(mixin_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(mixin_type, "root", strlen("root"), zend_declare_property_string(mixin_type, "root", strlen("root"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(Mixin, __construct) { PHP_METHOD(Mixin, __construct) {
...@@ -2315,8 +2320,8 @@ zend_class_entry* option_type; ...@@ -2315,8 +2320,8 @@ zend_class_entry* option_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Option", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Option",
Option, option) Option, option)
zend_declare_property_null(option_type, "name", strlen("name"), zend_declare_property_string(option_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(option_type, "value", strlen("value"), zend_declare_property_null(option_type, "value", strlen("value"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -2346,8 +2351,9 @@ zend_class_entry* source_context_type; ...@@ -2346,8 +2351,9 @@ zend_class_entry* source_context_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\SourceContext", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\SourceContext",
SourceContext, source_context) SourceContext, source_context)
zend_declare_property_null(source_context_type, "file_name", strlen("file_name"), zend_declare_property_string(source_context_type, "file_name",
ZEND_ACC_PRIVATE TSRMLS_CC); strlen("file_name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(SourceContext, __construct) { PHP_METHOD(SourceContext, __construct) {
...@@ -2374,8 +2380,8 @@ zend_class_entry* string_value_type; ...@@ -2374,8 +2380,8 @@ zend_class_entry* string_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\StringValue", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\StringValue",
StringValue, string_value) StringValue, string_value)
zend_declare_property_null(string_value_type, "value", strlen("value"), zend_declare_property_string(string_value_type, "value", strlen("value"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
PHP_METHOD(StringValue, __construct) { PHP_METHOD(StringValue, __construct) {
...@@ -2440,17 +2446,17 @@ zend_class_entry* type_type; ...@@ -2440,17 +2446,17 @@ zend_class_entry* type_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Type", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\Type",
Type, type) Type, type)
zend_declare_property_null(type_type, "name", strlen("name"), zend_declare_property_string(type_type, "name", strlen("name"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(type_type, "fields", strlen("fields"), zend_declare_property_null(type_type, "fields", strlen("fields"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(type_type, "oneofs", strlen("oneofs"), zend_declare_property_string(type_type, "oneofs", strlen("oneofs"), "",
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(type_type, "options", strlen("options"), zend_declare_property_null(type_type, "options", strlen("options"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(type_type, "source_context", strlen("source_context"), zend_declare_property_null(type_type, "source_context", strlen("source_context"),
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
zend_declare_property_null(type_type, "syntax", strlen("syntax"), zend_declare_property_long(type_type, "syntax", strlen("syntax"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -2483,7 +2489,7 @@ zend_class_entry* u_int32_value_type; ...@@ -2483,7 +2489,7 @@ zend_class_entry* u_int32_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt32Value", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt32Value",
UInt32Value, u_int32_value) UInt32Value, u_int32_value)
zend_declare_property_null(u_int32_value_type, "value", strlen("value"), zend_declare_property_long(u_int32_value_type, "value", strlen("value"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
...@@ -2511,7 +2517,7 @@ zend_class_entry* u_int64_value_type; ...@@ -2511,7 +2517,7 @@ zend_class_entry* u_int64_value_type;
// Init class entry. // Init class entry.
PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt64Value", PHP_PROTO_INIT_SUBMSGCLASS_START("Google\\Protobuf\\UInt64Value",
UInt64Value, u_int64_value) UInt64Value, u_int64_value)
zend_declare_property_null(u_int64_value_type, "value", strlen("value"), zend_declare_property_long(u_int64_value_type, "value", strlen("value"), 0,
ZEND_ACC_PRIVATE TSRMLS_CC); ZEND_ACC_PRIVATE TSRMLS_CC);
PHP_PROTO_INIT_SUBMSGCLASS_END PHP_PROTO_INIT_SUBMSGCLASS_END
......
...@@ -5,6 +5,7 @@ require_once('test_util.php'); ...@@ -5,6 +5,7 @@ require_once('test_util.php');
use Google\Protobuf\RepeatedField; use Google\Protobuf\RepeatedField;
use Google\Protobuf\GPBType; use Google\Protobuf\GPBType;
use Foo\TestStringValue;
use Foo\TestAny; use Foo\TestAny;
use Foo\TestEnum; use Foo\TestEnum;
use Foo\TestMessage; use Foo\TestMessage;
...@@ -167,6 +168,14 @@ class EncodeDecodeTest extends TestBase ...@@ -167,6 +168,14 @@ class EncodeDecodeTest extends TestBase
$this->assertSame("\"a\"", $m->serializeToJsonString()); $this->assertSame("\"a\"", $m->serializeToJsonString());
} }
public function testEncodeStringValue()
{
$m = new TestStringValue(['field' => new StringValue(['value' => ''])]);
var_dump($m->getField());
var_dump($m->serializeToJsonString());
$this->assertSame("{\"field\":\"\"}", $m->serializeToJsonString());
}
public function testDecodeTopLevelBytesValue() public function testDecodeTopLevelBytesValue()
{ {
$m = new BytesValue(); $m = new BytesValue();
......
...@@ -31,6 +31,7 @@ require_once('generated/Foo/TestPackedMessage.php'); ...@@ -31,6 +31,7 @@ require_once('generated/Foo/TestPackedMessage.php');
require_once('generated/Foo/TestPhpDoc.php'); require_once('generated/Foo/TestPhpDoc.php');
require_once('generated/Foo/TestRandomFieldOrder.php'); require_once('generated/Foo/TestRandomFieldOrder.php');
require_once('generated/Foo/TestReverseFieldOrder.php'); require_once('generated/Foo/TestReverseFieldOrder.php');
require_once('generated/Foo/TestStringValue.php');
require_once('generated/Foo/TestUnpackedMessage.php'); require_once('generated/Foo/TestUnpackedMessage.php');
require_once('generated/Foo/testLowerCaseMessage.php'); require_once('generated/Foo/testLowerCaseMessage.php');
require_once('generated/Foo/testLowerCaseEnum.php'); require_once('generated/Foo/testLowerCaseEnum.php');
......
syntax = "proto3"; syntax = "proto3";
import 'google/protobuf/any.proto'; import 'google/protobuf/any.proto';
import 'google/protobuf/wrappers.proto';
import 'google/protobuf/struct.proto'; import 'google/protobuf/struct.proto';
import 'proto/test_include.proto'; import 'proto/test_include.proto';
import 'proto/test_no_namespace.proto'; import 'proto/test_no_namespace.proto';
...@@ -207,3 +208,7 @@ enum testLowerCaseEnum { ...@@ -207,3 +208,7 @@ enum testLowerCaseEnum {
message TestAny { message TestAny {
google.protobuf.Any any = 1; google.protobuf.Any any = 1;
} }
message TestStringValue {
google.protobuf.StringValue field = 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment