Allow bytes field to be longer than 16000 bytes (#5924) * Allow bytes field to be longer than 16000 bytes * Remove empty line
diff --git a/php/tests/encode_decode_test.php b/php/tests/encode_decode_test.php index 1325db2..5b373bb 100644 --- a/php/tests/encode_decode_test.php +++ b/php/tests/encode_decode_test.php
@@ -167,6 +167,23 @@ $this->assertSame("\"YQ==\"", $m->serializeToJsonString()); } + public function generateRandomString($length = 10) { + $randomString = str_repeat("+", $length); + for ($i = 0; $i < $length; $i++) { + $randomString[$i] = rand(0, 255); + } + return $randomString; + } + + public function testEncodeTopLevelLongBytesValue() + { + $m = new BytesValue(); + $data = $this->generateRandomString(12007); + $m->setValue($data); + $expected = "\"" . base64_encode($data) . "\""; + $this->assertSame(strlen($expected), strlen($m->serializeToJsonString())); + } + public function testEncode() { $from = new TestMessage();