aboutsummaryrefslogtreecommitdiff
path: root/php/src/Google/Protobuf/Internal/GPBUtil.php
diff options
context:
space:
mode:
Diffstat (limited to 'php/src/Google/Protobuf/Internal/GPBUtil.php')
-rw-r--r--php/src/Google/Protobuf/Internal/GPBUtil.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php
index b75d9bab..7b5cc7d1 100644
--- a/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ b/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -305,11 +305,8 @@ class GPBUtil
$name,
$file_proto)
{
- $parts = explode('.', $name);
- foreach ($parts as $i => $part) {
- $parts[$i] = static::getClassNamePrefix($parts[$i], $file_proto) . $parts[$i];
- }
- return implode('\\', $parts);
+ $classname = implode('_', explode('.', $name));
+ return static::getClassNamePrefix($classname, $file_proto) . $classname;
}
public static function getClassNameWithoutPackage(
@@ -441,8 +438,8 @@ class GPBUtil
$nanoseconds = intval($nanoseconds);
// remove the nanoseconds and preceding period from the timestamp
- $date = substr($timestamp, 0, $periodIndex - 1);
- $timezone = substr($timestamp, $periodIndex + $nanosecondsLength);
+ $date = substr($timestamp, 0, $periodIndex);
+ $timezone = substr($timestamp, $periodIndex + $nanosecondsLength + 1);
$timestamp = $date.$timezone;
}
}