Flash 9 AMF3 Bug?

Looks like I hit a design bug in Flash 9's AMF3 encoding and checking the sources of AMF3 deserializers out there tells me that the Array related condition this bug affects is not being handled properly, probably causing Flash servers to throw up mysteriously and leave developers scratching their heads.
An array in AMF3 can be either a list of typed values or an associative array of name/value pairs. The former has entry count greater than zero and empty key. Later has zero entry count and non-empty key. So far so good although I see no good reasons for them to squeeze the two under one type code (9).
Problem starts with special cases. Empty arrays have zero entry count and empty first key without subsequent data. Associative arrays with a name/value pair with empty name also starts with the same sequence of bytes (09 01 01). I don't see a way for deserializers to tell the two apart.
To be more specific, following two arrays are starts with same 3 byte sequences when encoded in AMF3:

var array1:Array = [];

var array2:Array = new Array();  array2[""] = 1; array2["2"] = 2;

<p>I am too lazy to file a bug report so this blog post is the equivalent of yelling at the end of my driveway in pajamas. Can someone from Adobe confirm? How am I suppose to handle arrays starting with 09 01 01 byte sequence when the array is not at the end of the payload?
My apology to non-geeks for this blatant display of geekery.
Advertisements