diff --git a/protobuf/type/pb_string.php b/protobuf/type/pb_string.php index de49ed9..04ec21b 100644 --- a/protobuf/type/pb_string.php +++ b/protobuf/type/pb_string.php @@ -35,7 +35,7 @@ public function SerializeToString($rec = -1) $string .= $this->base128->set_value($rec << 3 | $this->wired_type); } - $string .= $this->base128->set_value(strlen($this->value)); + $string .= $this->base128->set_value(strlen($this->value ? $this->value : '')); $string .= $this->value; return $string;