Browse Source

Fixing HHVM Compatibility (#3437)

Ryan Gordon 8 years ago
parent
commit
9df89ccabc
1 changed files with 2 additions and 4 deletions
  1. 2 4
      php/src/Google/Protobuf/Internal/Message.php

+ 2 - 4
php/src/Google/Protobuf/Internal/Message.php

@@ -841,7 +841,6 @@ class Message
                 if (is_null($value)) {
                     continue;
                 }
-                $getter = $field->getGetter();
                 $key_field = $field->getMessageType()->getFieldByNumber(1);
                 $value_field = $field->getMessageType()->getFieldByNumber(2);
                 foreach ($value as $tmp_key => $tmp_value) {
@@ -858,13 +857,12 @@ class Message
                         $this->convertJsonValueToProtoValue(
                             $tmp_value,
                             $value_field);
-                    $this->$getter()[$proto_key] = $proto_value;
+                    self::kvUpdateHelper($field, $proto_key, $proto_value);
                 }
             } else if ($field->isRepeated()) {
                 if (is_null($value)) {
                     continue;
                 }
-                $getter = $field->getGetter();
                 foreach ($value as $tmp) {
                     if (is_null($tmp)) {
                         throw new \Exception(
@@ -872,7 +870,7 @@ class Message
                     }
                     $proto_value =
                         $this->convertJsonValueToProtoValue($tmp, $field);
-                    $this->$getter()[] = $proto_value;
+                    self::appendHelper($field, $proto_value);
                 }
             } else {
                 $setter = $field->getSetter();