aboutsummaryrefslogtreecommitdiff
path: root/php/src/Google/Protobuf/Internal/Message.php
diff options
context:
space:
mode:
Diffstat (limited to 'php/src/Google/Protobuf/Internal/Message.php')
-rw-r--r--php/src/Google/Protobuf/Internal/Message.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php
index 8ff141ca..147aaab8 100644
--- a/php/src/Google/Protobuf/Internal/Message.php
+++ b/php/src/Google/Protobuf/Internal/Message.php
@@ -1157,9 +1157,17 @@ class Message
public function parseFromJsonStream($input)
{
$array = json_decode($input->getData(), true, 512, JSON_BIGINT_AS_STRING);
+ if ($this instanceof \Google\Protobuf\ListValue) {
+ $array = ["values"=>$array];
+ }
if (is_null($array)) {
- throw new GPBDecodeException(
- "Cannot decode json string.");
+ if ($this instanceof \Google\Protobuf\Value) {
+ $this->setNullValue(\Google\Protobuf\NullValue::NULL_VALUE);
+ return;
+ } else {
+ throw new GPBDecodeException(
+ "Cannot decode json string: " . $input->getData());
+ }
}
try {
$this->mergeFromJsonArray($array);