aboutsummaryrefslogtreecommitdiff
path: root/php/src/Google
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2017-06-20 22:53:22 -0700
committerGitHub <noreply@github.com>2017-06-20 22:53:22 -0700
commit8ecae34ac65218e9fda1586abc39f8762dbb40de (patch)
treef5ebd70dd889b94872f0e4fe75704d21998dd4cd /php/src/Google
parentbf04c83267619b618e7112b242f424f8b3e785b6 (diff)
parent3b1a87518cead7403b8e13c41945e41a30d602e4 (diff)
downloadprotobuf-8ecae34ac65218e9fda1586abc39f8762dbb40de.tar.gz
protobuf-8ecae34ac65218e9fda1586abc39f8762dbb40de.tar.bz2
protobuf-8ecae34ac65218e9fda1586abc39f8762dbb40de.zip
Merge pull request #3255 from TeBoring/3.3.x-3
Cherry-pick bug fixes for php
Diffstat (limited to 'php/src/Google')
-rw-r--r--php/src/Google/Protobuf/Internal/Message.php7
-rw-r--r--php/src/Google/Protobuf/descriptor.php2
2 files changed, 8 insertions, 1 deletions
diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php
index cd15e0f0..10c639ac 100644
--- a/php/src/Google/Protobuf/Internal/Message.php
+++ b/php/src/Google/Protobuf/Internal/Message.php
@@ -739,6 +739,13 @@ class Message
*/
private function existField($field)
{
+ $oneof_index = $field->getOneofIndex();
+ if ($oneof_index !== -1) {
+ $oneof = $this->desc->getOneofDecl()[$oneof_index];
+ $oneof_name = $oneof->getName();
+ return $this->$oneof_name->getNumber() === $field->getNumber();
+ }
+
$getter = $field->getGetter();
$value = $this->$getter();
return $value !== $this->defaultValue($field);
diff --git a/php/src/Google/Protobuf/descriptor.php b/php/src/Google/Protobuf/descriptor.php
index fb69eda0..35e4929b 100644
--- a/php/src/Google/Protobuf/descriptor.php
+++ b/php/src/Google/Protobuf/descriptor.php
@@ -236,7 +236,7 @@ function getClassNamePrefix(
return $prefix;
}
- $reserved_words = array("Empty");
+ $reserved_words = array("Empty", "ECHO", "ARRAY");
foreach ($reserved_words as $reserved_word) {
if ($classname === $reserved_word) {
if ($file_proto->getPackage() === "google.protobuf") {