aboutsummaryrefslogtreecommitdiff
path: root/php/src/Google/Protobuf/Internal/GPBUtil.php
diff options
context:
space:
mode:
authorPaul Yang <TeBoring@users.noreply.github.com>2018-09-22 18:57:43 -0700
committerGitHub <noreply@github.com>2018-09-22 18:57:43 -0700
commit9bda1f19bf12aaf62a3bf65e8f72c72f82ff7af7 (patch)
tree2b96da21c057c4c862995554022a54881f492dc6 /php/src/Google/Protobuf/Internal/GPBUtil.php
parent47d33e752e5256bec315e5867b940ca33d66e8a2 (diff)
downloadprotobuf-9bda1f19bf12aaf62a3bf65e8f72c72f82ff7af7.tar.gz
protobuf-9bda1f19bf12aaf62a3bf65e8f72c72f82ff7af7.tar.bz2
protobuf-9bda1f19bf12aaf62a3bf65e8f72c72f82ff7af7.zip
Adopt upb change for timestamp and duration json to php (#5106)
* Adopt upb change for timestamp and duration json to php * Remove unused code * Re-sync upb * Fix php implementation timestamp json parsing * Fix strptime use local timezone on mac. * Remove succeeding tests * Resync * Add tests for values * Fix php tests * Fix encoder handlers change default value Previously, oneofsubmsg_handler and submsg_handler change zval's default value directly. The fix use REPLACE_ZVAL_VALUE which create a copy of parsed value and assign it to zval.
Diffstat (limited to 'php/src/Google/Protobuf/Internal/GPBUtil.php')
-rw-r--r--php/src/Google/Protobuf/Internal/GPBUtil.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php
index ec0bf6bd..7b5cc7d1 100644
--- a/php/src/Google/Protobuf/Internal/GPBUtil.php
+++ b/php/src/Google/Protobuf/Internal/GPBUtil.php
@@ -438,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;
}
}