aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src/Google/Protobuf/descriptor.php
diff options
context:
space:
mode:
Diffstat (limited to 'php/src/Google/Protobuf/descriptor.php')
-rw-r--r--php/src/Google/Protobuf/descriptor.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/php/src/Google/Protobuf/descriptor.php b/php/src/Google/Protobuf/descriptor.php
index e5cff0ba..ef6b9dcf 100644
--- a/php/src/Google/Protobuf/descriptor.php
+++ b/php/src/Google/Protobuf/descriptor.php
@@ -215,6 +215,18 @@ class Descriptor
return $desc;
}
}
+
+function addPrefixIfSpecial(
+ $name,
+ $package)
+{
+ if ($name === "Empty" && $package === "google.protobuf") {
+ return "GPBEmpty";
+ } else {
+ return $name;
+ }
+}
+
function getFullClassName(
$proto,
$containing,
@@ -224,7 +236,8 @@ function getFullClassName(
&$fullname)
{
// Full name needs to start with '.'.
- $message_name_without_package = $proto->getName();
+ $message_name_without_package =
+ addPrefixIfSpecial($proto->getName(), $package);
if ($containing !== "") {
$message_name_without_package =
$containing . "." . $message_name_without_package;