ZF-7610: Zend_Amf_Server is hard-coded to AMF0


The Request.php and Response.php used by the Zend_Amf_Server are hard-coded to use the Amf0 serializer. This serializer does not support the Zend_Amf_Value_ByteArray class. Therefore, we have no way to return a ByteArray using the Zend_Amf_Server.

Is there some immediate workaround that lets us return a ByteArray using the present Zend_Amf_Server code? Can Zend_Amf_Server chose the serialization according to the objectEncoding member of the NetConnection object created on the client side? Is there some way to cast a string to a ByteArray in ActionScript3?

I'm using the mcrypt library in PHP and attempting to return encrypted strings to the client.


Sweet. I was able to make this work by modifying the Request.php file's _objectEncoding to 3. Do we just need some public function to set that near the server declaration?

All AMF requests are AMFO by default. They transfer to AMF3 for the rest of the serialization and deserilization process after they encounter and AMF3 object data type for the first time. That's why the default value is AMF0 but is updates after it changes object types to 3. Can you post a simple bytearray test that showcases the bug? I use it all the time and it works just fine.


I attempted tonight to make a simple test case for this issue. However, I can't even get any data back tonight (using trunk code 20213). I don't know what the deal is. I'll attach my two test files.

These files make up a basic return-a-ByteArray test.