From a323f1e65da2c512f971a2edf1918a0cca340015 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Fri, 27 Jan 2017 13:17:54 -0800 Subject: Oneof accessor should return the field name that is actually set. (#2631) --- src/google/protobuf/compiler/php/php_generator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/google/protobuf/compiler/php') 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()); -- cgit v1.2.3