--TEST-- Check for protocol buffers string implementations --FILE-- buffer .= $string; } public function __toString() { return $this->buffer; } } $u = new Tutorial_String(); $string = new MyString(); $string->append("Hello"); $u->setValue($string); $u2 = ProtocolBuffers::decode("Tutorial_String", ProtocolBuffers::encode($u)); echo $u2->getValue() . PHP_EOL; if (is_string($u2->getValue())) { echo "OK" . PHP_EOL; } else { echo "FAULT" . PHP_EOL; } if ($u->getValue() instanceof MyString) { echo "OK" . PHP_EOL; } else { echo "FAULT" . PHP_EOL; } --EXPECT-- Hello OK OK