Zend Framework

Zend_Amf does not properly serialize Zend_Amf_Value_ByteArray instances

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.0
  • Fix Version/s: 1.7.2
  • Component/s: Zend_Amf
  • Labels:
    None

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:

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:

$this->writeString($data instanceof Zend_Amf_Value_ByteArray ? $data->getData() : $data);

Activity

Hide
Wade Arnold added a comment -

Added support for Zend_Amf_Value_ByteArray::getData into the serialization process.

Show
Wade Arnold added a comment - Added support for Zend_Amf_Value_ByteArray::getData into the serialization process.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: