Issues

ZF-5388: Zend_Amf_Server handles arguments wrong

Issue Type: Bug Created: 2008-12-31T06:22:20.000+0000 Last Updated: 2009-03-24T12:34:36.000+0000 Status: Closed Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Dirk Thomas (dthomas) Assignee: Wade Arnold (wadearnold) Tags: - Zend_Amf

Related issues: - ZF-5831

Attachments:

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

Posted by Romu (soundstep) on 2009-01-19T10:06:16.000+0000

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>

Posted by Wade Arnold (wadearnold) on 2009-02-06T07:33:03.000+0000

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.

Posted by Wade Arnold (wadearnold) on 2009-02-06T11:41:41.000+0000

Change has been committed to trunk with unit tests.

Posted by Dirk Thomas (dthomas) on 2009-02-08T07:47:34.000+0000

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

Posted by yens resmann (yens.resmann) on 2009-02-26T04:52:37.000+0000

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.

Posted by Roger Blum (rb) on 2009-03-12T13:29:51.000+0000

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.

Posted by Wade Arnold (wadearnold) on 2009-03-16T14:09:46.000+0000

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

Posted by Wade Arnold (wadearnold) on 2009-03-16T14:13:28.000+0000

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

Posted by Wade Arnold (wadearnold) on 2009-03-24T12:34:35.000+0000

This issue has been added to the 1.7 release branch.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts