ZF-11490: Zend Json Server error response with result


The server is adding result key in response even when it is error. According to http://groups.google.com/group/json-rpc/… This member MUST NOT exist if there was an error invoking the method.

So using most json rpc 2.0 clients will throw an exception. I currently comment out Zend/Json/Server/Response.php line 176 to make it work with jsonrpc clients.

-- EDIT: actually its same with error at line 184. This member MUST NOT exist if there was no error triggered during invocation. - for error


I confirmed it. The opposite is also true: if a request is succesful, an error property is included in the response, while it MUST NOT. My next action will be to create a unit test that confirms both bugs.

Added patches for Response.php and ResponseTest.php

Changed to patch, because there are patches now that you can use. I had to change existing unit tests, because they were wrong. The error and result may not coexist in the response.

If no one complains about the solution, I will commit this within a week. I will leave the issue open for integration in ZF 2.0

Committed to svn trunk at revision 24251

Merged into the 1.11 branch from revision 24251 in trunk.

The patch seems to not have made it in the 1.11.10 release


You are right. I can see it is not in the current 1.11 release branch. Something must have gone wrong with the original merge.

I have merged the changes from trunk back into the 1.11 release branch and commited the changes to the 1.11 branch. With the next mini release, this should become available. Thanks for your feedback.

'Affects versions' field updated to '1.11.10'