The first byte of an AMF envelope actually does have a meaning. I was able to email with Peter Farland from Adobe tonight as I was finishing up some code rework for Zend_AMF and he explained that the first two bytes are actually one value and read as an unsigned short integer. I have updated the documentation on OSFlash. Lets see how long it takes for every opensource AMF implementation to not have code that says something like this in AMFPHP:
$topByte = $this->readByte(); // ignore the first two bytes -- version or something
$secondByte = $this->readByte(); //0 for Flash 8, 1 for FlashComm, 3 for flash player 9
AMFPHP, Flash Platform, Zend_Amf
I am speaking about a project that I have been working on with Adobe and Zend at ZendCon this year. I am supper excited about this advancement as it brings together to languages that I love. Drop a comment if you are thinking about going or want to meet up. Also if there is something specific that you want to see in the presentation let me know! Session information should be released in the enxt couple weeks on the ZendCon website under RIA
ActionScript 3, Flash Platform, Zend_Amf
In response to some questions and emails
The specification for AMF serialization define a type market for each data type. There are 13 types in AMF A type marker is one byte in length and describes the type of encoded data that follows. The general data type is very simple to handle but what is more inportant is when a second byte exists called the ecoding type byte. Type markers may be followed by the actual encoded type data, or if the marker
represents a single possible value (such as null) then no further information needs to be encoded. What data type you need to serialize based on the first byte of data field. Once you get this type you there. This is fine if you have all the time in the world to implement every type in the specification. However most people when they think of array they think of just one type. But there are three types of arrays defined by AMF and if you really want a complete implementation you need to handle all three. Outside of teh speficication people really think of AMF as Life Cycle Data Services. I need AMF in php usually is someone implying that they want all the functionality of LifeCycle DS in PHP. This is really where the OOp functionality comes into play. A fully imlemented AF gateway falls well short of LifeCycle. In the next serialization implementation that I am working on it has to be able to add these additional mapping tools that are more generic than class mapping your custom classes to be a part of the release. A common request is ArrayCollections. Class mapping ArrayCollections is something that you need in almost every Flex project but it really is not part of the AMF specification. In this specific case AMF would treat the incoming Data as an object type which it is. By using a more OOP implementation it is easy to add this as an object type but then also used an optimized ArrayCollection handler that is part of the core library’s without having to have everyone role there own.
Headers fall into this too. Most developers like to toss additional session specific or session instantiation specific data into the AMF header. The new aproach allows you to create your own handlers for those headers and of course support the defined amf_server_debug, Credentials, DescribeService.
ActionScript 3, Flash Platform, Zend_Amf
I have been working on a new code base for Amf to PHP Serialize’er and it all seems to be working. I am super excited about this! Mostly because I have spent the last 5 weeks working on building the architecture the way that I have always wanted it and it actually worked! It makes it super easy to make new amf/value/newtype.php so that the filter can be applied to the byte type coming in. You can also add amf/header/types.php so that you can easily deal with incoming AMF headers for things such as security. My hope is that this architecture keeps serialization advancements available to other developers so that it is not always on the project leads. So far the tests are really fast even with additional OOP functionality.
This is the last 38 hours of consumption minus starbucks trips and office coffee just so that I could make Mike Potter happy.
Love!

ActionScript 3, Flash Platform, Zend_Amf
Working on optimizations for AMF serialization and I want to finalize on just using the default ord function or actually using one of the fancier libraries such as mbstring or iconv. However I am not able to find very much information on what is the preferred library to code against. Surfing google shows that “everyone” likes iconv as it is almost always there on linux but suggest that mbstring is more portable? However there does not seem to be any suggestion as to what new developers should code against. I really like the additional methods that iconv and mbstring provide and both suggest optimizations although I would have to write my own tests to prove any optimizations. Can anyone lead me to some more detailed information on what the community wants to adopt?
– Update: ICONV it is! –
“mbstring offers better support and more options. However, it’s not enabled in vanilla PHP installs — whereas iconv _is_. So, for that reason, we typically recommend utilizing iconv. (I actually switched from using mbstring to iconv in Zend_XmlRpc for this reason.)”
Matthew Weier O’Phinney
Software Architect
Zend Framework
AMFPHP, Flash Platform, Zend_Amf
Recent Comments