ZF-5592: CLONE -Zend_Amf does not properly serialize Zend_Amf_Value_ByteArray instances


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);


Hi Wade,

This issue is not fixed in the minimal framework version 1.7.3 that I am using. The fix noted above (from the earlier issue) seems to work well though.


I am not sure what version this was resolved in but I know that it is in the ZF 1.7.8 release. Thanks!