ZF-5078: Zend_Amf does not properly serialize Zend_Amf_Value_ByteArray instances
Description
In attempting to switch from AMFPHP to Zend_Amf, I ran across the following issue:
The AMF3 encoding doesn't seem to be correct for ByteArray instances. When returning a Zend_Amf_Value_ByteArray instance, the serializer attempts to pass the instance to its writeString method, which attempts to treat it as a simple string, causing php to send the incorrect data as well as emit a notice as follows:
bq. Notice: Object of class Zend_Amf_Value_ByteArray to string conversion
One way to avoid this and properly return the binary data to the server is to modify line 81 of Zend\Amf\Parse\Amf3\Serializer.php to read:
bq. $this->writeString($data instanceof Zend_Amf_Value_ByteArray ? $data->getData() : $data);
Comments
Posted by Wade Arnold (wadearnold) on 2008-12-12T14:31:10.000+0000
Added support for Zend_Amf_Value_ByteArray::getData into the serialization process.