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

Description

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

Comments

Patch included.

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