Initialize wrapper message during parsing (#6974)
* Initialize wrapper message during parsing
In case the internal value is default
* Fix zts build
diff --git a/php/tests/encode_decode_test.php b/php/tests/encode_decode_test.php
index 53cd526..319e332 100644
--- a/php/tests/encode_decode_test.php
+++ b/php/tests/encode_decode_test.php
@@ -1164,6 +1164,18 @@
$m->serializeToJsonString());
}
+ public function testEncodeAnyWithDefaultWrapperMessagePacked()
+ {
+ $any = new Any();
+ $any->pack(new TestInt32Value([
+ 'field' => new Int32Value(['value' => 0]),
+ ]));
+ $this->assertSame(
+ "{\"@type\":\"type.googleapis.com/foo.TestInt32Value\"," .
+ "\"field\":0}",
+ $any->serializeToJsonString());
+ }
+
public function testDecodeTopLevelFieldMask()
{
$m = new TestMessage();