Port of http://pecl.php.net/package/amfext/0.9.2 to php 5.3.X