diff --git a/php/src/Google/Protobuf/Internal/CodedInputStream.php b/php/src/Google/Protobuf/Internal/CodedInputStream.php index 33f4a456af..33b1f5a9ba 100644 --- a/php/src/Google/Protobuf/Internal/CodedInputStream.php +++ b/php/src/Google/Protobuf/Internal/CodedInputStream.php @@ -299,8 +299,12 @@ class CodedInputStream return false; } - $buffer = substr($this->buffer, $this->current, $size); - $this->advance($size); + if ($size === 0) { + $buffer = ""; + } else { + $buffer = substr($this->buffer, $this->current, $size); + $this->advance($size); + } return true; }