ZF-5391: Flash Media Server 3 - Zend Amf

Description

Asked Wade and he asked me to shoot it as a bug.

I've been trying to use serverside remoting in FMS3 with ZendAMF but no luck. I get "onStatus>info.code: Client.Header.BadVersion" in FMSLiveLog

But when i try to use the samegateway with Flex there is np and eveything works smooth.

Thought it might be smthing related to amf version but FMS3 should also use AMF3?

Comments

I think this issue is indeed FMS3 related. when I checked the $HTTP_RAW_POST_DATA ( php://input ) and FMS3 reports its objectEncoding version as 0x01 not 0x00 or 0x03. It could be a bug or part of the FMS failsave for connecting to AMF0 encoded servers I don't know.

Anyways, added a check at class Zend_Amf_Request at function readMessage solved it for me.


    /**
     * Takes the raw AMF input stream and converts it into valid PHP objects
     *
     * @param  Zend_Amf_Parse_InputStream
     * @return Zend_Amf_Request
     */
    public function readMessage(Zend_Amf_Parse_InputStream $stream)
    {
        $clientVersion = $stream->readUnsignedShort();
        if (($clientVersion != Zend_Amf_Constants::AMF0_OBJECT_ENCODING)
            // Added Check for 0x01 for FMS. Could be defined a const as well.
            && ($clientVersion != 0x01) 
            && ($clientVersion != Zend_Amf_Constants::AMF3_OBJECT_ENCODING)
        ) {
            require_once 'Zend/Amf/Exception.php';
            throw new Zend_Amf_Exception('Unknown Player Version ' . $clientVersion);
        }

Hope this helps.

Thanks for the code sample. Will be added to the next mini release.