Home > AMFPHP, Flash Platform, Zend_Amf > Mixed Array’s in Zend Amf are not generic objects

Mixed Array’s in Zend Amf are not generic objects

October 22nd, 2008

The reason that AMFPHP just returned generic objects rather than mixed array is because it was primarly based off of AS2 which did not have mixed arrays only generic objects. Now that we have AS3 and actually able to re-write the parser we are going to return mixed arrays when that is the real data type for Amf3. This is not a bug it’s more that the bug was actually fixed.

So if you really want to return a generic array when you have a mixed array in php you can just cast the return and it will work like AMFPHP did.

public function returnData()
{
  $data = array(“one”, “two” => “three”);
  return (object) $data
}

AMFPHP, Flash Platform, Zend_Amf

  1. October 22nd, 2008 at 12:50 | #1

    Just curious, is any of the work your doing with zend going to be integrated into amfphp as well?

  2. October 22nd, 2008 at 13:18 | #2

    @flashape The core functionality of AMFPHP will be built on top of Zend_Amf in the future. The goal will be to then back port those features to zend in each of the release. AMFPHP and Zend_Amf only implment one command message and remote message and there is a lot more to play with.

  3. John
    October 23rd, 2008 at 15:04 | #3

    Wade –
    I attended the online Flex and Zend eSeminar by Lee Brimelow the other day. During the meeting, it was discussed that ZendAMF won’t support AMFExt at this time. Do you plan on supporting it in the future?

  4. October 23rd, 2008 at 15:37 | #4

    @John The architecture of Zend Amf was designed to easily add AMFext. I personally use it on projects. I am not sure if it will be part of the Zend release but I can assure you that I will have a patch to enable it!

  5. February 9th, 2009 at 13:38 | #5

    Wade, I have several existing flash applications using AMFPHP and built in AS2. I really like the flexibility of the new Zend_Amf and I am wondering if it is at all possible to utilize Zend_Amf with AS2. For new projects I will obviously be using AS3, but can I tweak my existing AS2 projects to leverage Zend_Amf? Based on what I’m reading here it looks like that is not possible, what do you think?

  6. February 9th, 2009 at 15:49 | #6

    @Jared I have no idea what you are reading but it is wrong. Zend Amf implements Amf0 and Amf3. All AMF connections initially are AMF0 and until they hit a data type that is only supported in AMF3 it stays AMF0. Most calls from flex when using a netconnection are AMF0 calls. Simple answer…. it will work just fine with AS2.

  7. Xeress
    September 11th, 2009 at 03:43 | #7

    Isn’t it a better idea to create a method so you can swap to the old ‘buggy’ behavior? For example, i have build some stuff on amfphp and want to migrate to the Zend_amf. That require alot of rewriting right now.

    I’ll probably create such feature on my own, though an official feature would help everyone ;) .

  1. No trackbacks yet.