ZF-5388: Zend_Amf_Server handles arguments wrong

Description

The method _handle(Zend_Amf_Request $request) of Zend_Amf_Server handles the passed arguments wrong when the message is of type AMF3 and sent via NetConnection.

Current source code Zend/Amf/Server.php line 306: $return = $this->_dispatch($method, array($body->getData()), $source);

Since the bodies data is already an array containing all passed arguments wrapping them in another array is wrong and should be modified to: $return = $this->_dispatch($method, $body->getData(), $source);

Else the number of passed arguments is always one - even if multiple arguments have been sent from flash - sincethe first argument is an array containing all arguments. In the following line 309 it is done correctly when dealing with only a different kind of method signature.

One minor note: $body->getData() could be replaced by: $message in both line (306 and 309)

Comments

hi, I'm not sure I understood well but it might be why I got something working with amfphp but not zend amf.

I'm trying to pass 3 arguments to a method: 1. a string 2. a array of string 3. a string

public function getDataWidthArrayParam($str1, $arr, $str2) { array_push($arr, "a", "b", "c"); return $arr; }

and I get a: Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion

while the same php is working with amfphp.

Also, if I pass an array (to a method that is waiting for one array) and return it with some changes, I get:

with amfphp: result: [0] = 1 [1] = 2 [2] = 2

with zend amf: result: [0] = [0] = 1 [1] = 2 [2] = 2

Shouldn't I get a normal array (like amfphp) instead of an array of one element containing the array returned?

Romu www.soundstep.com

The issue exists whenever an array is passed in as a parameter. This issue exists whenever an array is used as a single parameter or if one of the multiple parameters is an array.

Change has been committed to trunk with unit tests.

These changes have to merged to branches/release-1.7 to be included in the next release (1.7.4)

I'm having the exact same issue when I try to pass a ByteArray and a String together. I'm using 1.7.5. The same script works in AMFPHP 1.9.

Hi,

I have the same problems if 1 of the parameters is a Flex object (class Object). I 've updated to version 1.7.6 and the problem (with arrays and objects) still persists.

Changes have been approved and committed to the trunk to resolve issue.

Contacted Wil and Matthew about getting helping me figure out how to get this merged into the next minor release.

This issue has been added to the 1.7 release branch.