diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-02-07 21:33:28 -0800 |
---|---|---|
committer | Paul Yang <TeBoring@users.noreply.github.com> | 2017-03-15 14:16:49 -0700 |
commit | f23869c6154d8b083ee3417fac277bc25e13a4ac (patch) | |
tree | 2e9ea1cfcc88211ac1e364155d696c808acb11ba /php/src/Google/Protobuf/Internal/Message.php | |
parent | 014a5507fb4b1ccc12f35ff313b8a04c05d69b7f (diff) | |
download | protobuf-f23869c6154d8b083ee3417fac277bc25e13a4ac.tar.gz protobuf-f23869c6154d8b083ee3417fac277bc25e13a4ac.tar.bz2 protobuf-f23869c6154d8b083ee3417fac277bc25e13a4ac.zip |
Bug fix: When encoding, negative int32 values should be padded to int64 (#2660)
in order to be wire compatible.
Diffstat (limited to 'php/src/Google/Protobuf/Internal/Message.php')
-rw-r--r-- | php/src/Google/Protobuf/Internal/Message.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index ca4fde02..887c86ca 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -772,9 +772,11 @@ class Message case GPBType::SFIXED64: $size += 8; break; - case GPBType::UINT32: case GPBType::INT32: case GPBType::ENUM: + $size += GPBWire::varint32Size($value, true); + break; + case GPBType::UINT32: $size += GPBWire::varint32Size($value); break; case GPBType::UINT64: |