aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/php
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2017-01-27 13:17:54 -0800
committerGitHub <noreply@github.com>2017-01-27 13:17:54 -0800
commita323f1e65da2c512f971a2edf1918a0cca340015 (patch)
tree22ae538979fd53567f144a112b069ae2706a03e0 /src/google/protobuf/compiler/php
parent5af0b547de7aba6d6206943546262cb21fedc721 (diff)
downloadprotobuf-a323f1e65da2c512f971a2edf1918a0cca340015.tar.gz
protobuf-a323f1e65da2c512f971a2edf1918a0cca340015.tar.bz2
protobuf-a323f1e65da2c512f971a2edf1918a0cca340015.zip
Oneof accessor should return the field name that is actually set. (#2631)
Diffstat (limited to 'src/google/protobuf/compiler/php')
-rw-r--r--src/google/protobuf/compiler/php/php_generator.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
index be2739ff..36f00acd 100644
--- a/src/google/protobuf/compiler/php/php_generator.cc
+++ b/src/google/protobuf/compiler/php/php_generator.cc
@@ -864,7 +864,7 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
printer.Print(
"public function get^camel_name^()\n"
"{\n"
- " return $this->^name^;\n"
+ " return $this->whichOneof(\"^name^\");\n"
"}\n\n",
"camel_name", UnderscoresToCamelCase(oneof->name(), true), "name",
oneof->name());