ZF-6131: Unexpected behavior invoking methods with named-parameters

Issue Type: Bug Created: 2009-03-26T03:52:43.000+0000 Last Updated: 2010-05-24T12:06:24.000+0000 Status: Closed Fix version(s): - 1.10.5 (26/May/10)

Reporter: Andrea Montemaggio (klinamen) Assignee: Andy Fowler (andyfowler) Tags: - Zend_Json_Server

Related issues: - ZF-9517



When a method call is issued using named parameters instead of an array of values, the JSON hash representing param-value pairs seems to be interpreted as ordered, so a true mapping between names of PHP method parameters and param-values pairs is not realized.

For example if we have a PHP method: public function subtract($a, $b){ return $a-$b;}

and a JSON-RPC invocation {"id":1,"method":"subtract","params":{"b":10,"a":50},"version":"json-rpc-2.0"}

the resulting PHP method invocation will be subtract(10,50), leading to an unexpected value of -40 instead of 40.

Best regards, Andrea Montemaggio


Posted by A.J. Brown (ajbrown) on 2010-03-23T09:43:14.000+0000

Patch included.

Posted by Andy Fowler (andyfowler) on 2010-05-24T12:06:20.000+0000

This was only marked as related to ZF-9517, but it seems to be a full duplicate. Closing.

Have you found an issue?

See the Overview section for more details.


© 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.