Zend Framework

Zend_Amf_Server handles arguments wrong

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.7.2
  • Fix Version/s: 1.8.0
  • Component/s: Zend_Amf
  • Labels:
    None

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)

Issue Links

Activity

Hide
Romu added a comment -

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

Show
Romu added a comment - 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
Hide
Wade Arnold added a comment -

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.

Show
Wade Arnold added a comment - 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.
Hide
Wade Arnold added a comment -

Change has been committed to trunk with unit tests.

Show
Wade Arnold added a comment - Change has been committed to trunk with unit tests.
Hide
Dirk Thomas added a comment -

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

Show
Dirk Thomas added a comment - These changes have to merged to branches/release-1.7 to be included in the next release (1.7.4)
Hide
yens resmann added a comment -

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.

Show
yens resmann added a comment - 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.
Hide
Roger Blum added a comment -

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.

Show
Roger Blum added a comment - 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.
Hide
Wade Arnold added a comment -

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

Show
Wade Arnold added a comment - Changes have been approved and committed to the trunk to resolve issue.
Hide
Wade Arnold added a comment -

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

Show
Wade Arnold added a comment - Contacted Wil and Matthew about getting helping me figure out how to get this merged into the next minor release.
Hide
Wade Arnold added a comment -

This issue has been added to the 1.7 release branch.

Show
Wade Arnold added a comment - This issue has been added to the 1.7 release branch.

People

Vote (0)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: