Issues

ZF-10324: Additional parameters with ZendAMF-call result in Uncaught exception 'Zend_Amf_Exception' with message 'Undefined string reference:...'

Description

Today I found out that ZendAmf does not support the use of more than 1 parameters when using

 *NetConnection.call('Service.function',responder,new VOPost(), new VOFile());*

Because when I use a customVO like:


<?php
class VOFile
{
    public $_explicitType = 'vo.medium.VOFile';

    public $data;
    public $name;// + extension
    public $compressed;
    public $type;

    public function VOFile($name,$data,$type,$compressed = false)
    {
        $this->name = $name;
        $this->data = $data;
        $this->type = $type;
        $this->compressed = (bool)$compressed;
    }

    public function getASClassName()
    {
        return $this->$_explicitType;
    }
}
?>

its giving me an error when I send this VO from Flash (with jpg inside data-property) to ZendAMF.


package
{
    import flash.net.registerClassAlias;
    import flash.utils.ByteArray;
    [RemoteClass(alias="vo.medium.VOFile")]
 
    public class VOFile
    {
       public var data:ByteArray;
       public var name:String;
       public var type:String;
       public var compressed:Boolean;      
        
       public function VOFile(){}
        
       public static function register():void
       {      
          registerClassAlias("vo.medium.VOFile", VOFile);
       }        
    }
}

The identifiers are exactly the same, but I am getting the following error:

 
[16-Aug-2010 20:14:27] PHP Fatal error:  Uncaught exception 'Zend_Amf_Exception' with message 'Undefined string reference: 6' in /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Parse/Amf3/Deserializer.php:186
Stack trace:
#0 /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Parse/Amf3/Deserializer.php(372): Zend_Amf_Parse_Amf3_Deserializer->readString()
#1 /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Parse/Amf3/Deserializer.php(103): Zend_Amf_Parse_Amf3_Deserializer->readObject()
#2 /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Parse/Amf0/Deserializer.php(293): Zend_Amf_Parse_Amf3_Deserializer->readTypeMarker()
#3 /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Parse/Amf0/Deserializer.php(130): Zend_Amf_Parse_Amf0_Deserializer->readAmf3TypeMarker()
#4 /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Parse/Amf0/Deserializer.php(217): Zend_Amf_Parse_Amf0_Deserializer->readTypeMarker()
#5 /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Parse/Amf0/Deserializer.php(106): Zend_Amf_Parse_Amf0_Deserializer->readArray()
#6 /Users/gebru in /Users/gebruiker/work/php/PH29/frameworks/Zend/Amf/Request.php on line 176

Which only occurs when I am using two simple custom made VOs (like above) and send them as 2 parameters (like shown above) with my NetConnection.call. If I remove the second parameter I am getting no exception/error!! As you can see I am using pure Actionscript 3 projects (no flex) and the latest version of 1.10.7. All classes are correctly imported (require_once) and mapped (recognized because 1 parameter with same VO works).

I am still not sure whats the root cause: mapping the VOs or an deserialization error in ZendAMF? I am using the same FP10 compiled (Flex SDK3.5a) swf-file from which all above mentioned calls are made without changes to class mappings or paths. The strange thing is that the process is not even arriving at my Service.function in PHP/ZendAMF because when I log (with Zend_Log) I am not seeing anything happening even when I am uncommenting all my code except the return-value.

So I have not found posts online or here at zend.com about this kind of issues and I would like to know what could be wrong with adding parameters to AMF-function calls. Let me know if I need to provide more information.

Comments

Further research shows me that it gives these errors only when two typed objects are given as parameters. Strings and integers are allowed even with one custom VO but not with multiple custom VOs.