aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanley.cheung@gmail.com>2017-03-13 16:03:07 -0700
committerGravatar GitHub <noreply@github.com>2017-03-13 16:03:07 -0700
commit20a06a05e8a9659d3afc63caeebb80d9366f9bf5 (patch)
treec9042454fdce6071fc5a22940dad99ebd30eb4d1 /src
parent767adee10fb6528d684c48135f7ea9cd78c2e999 (diff)
parent55bff48335809baaab083bbf1189c3ab69a65f2b (diff)
Merge pull request #10134 from stanley-cheung/php-proto3-api-change
PHP: proto3 api change
Diffstat (limited to 'src')
-rw-r--r--src/php/lib/Grpc/AbstractCall.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/php/lib/Grpc/AbstractCall.php b/src/php/lib/Grpc/AbstractCall.php
index 40387abdc0..4833fdc7b6 100644
--- a/src/php/lib/Grpc/AbstractCall.php
+++ b/src/php/lib/Grpc/AbstractCall.php
@@ -131,6 +131,8 @@ abstract class AbstractCall
// Proto3 implementation
if (method_exists($data, 'encode')) {
return $data->encode();
+ } else if (method_exists($data, 'serializeToString')) {
+ return $data->serializeToString();
}
// Protobuf-PHP implementation
@@ -154,7 +156,11 @@ abstract class AbstractCall
if (is_array($this->deserialize)) {
list($className, $deserializeFunc) = $this->deserialize;
$obj = new $className();
- $obj->$deserializeFunc($value);
+ if (method_exists($obj, $deserializeFunc)) {
+ $obj->$deserializeFunc($value);
+ } else {
+ $obj->mergeFromString($value);
+ }
return $obj;
}