Zend Framework

Zend Json Server error response with result

Details

Description

The server is adding result key in response even when it is error.
According to http://groups.google.com/group/json-rpc/web/json-rpc-2-0
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

  1. Response.php.patch
    09/Jul/11 11:13 AM
    0.6 kB
    Bart McLeod
  2. ResponseTest.php.patch
    09/Jul/11 11:13 AM
    1 kB
    Bart McLeod

Activity

Hide
Bart McLeod added a comment -

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.

Show
Bart McLeod added a comment - 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.
Hide
Bart McLeod added a comment -

Added patches for Response.php and ResponseTest.php

Show
Bart McLeod added a comment - Added patches for Response.php and ResponseTest.php
Hide
Bart McLeod added a comment -

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

Show
Bart McLeod added a comment - 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
Hide
Bart McLeod added a comment -

Committed to svn trunk at revision 24251

Show
Bart McLeod added a comment - Committed to svn trunk at revision 24251
Hide
Bart McLeod added a comment -

Merged into the 1.11 branch from revision 24251 in trunk.

Show
Bart McLeod added a comment - Merged into the 1.11 branch from revision 24251 in trunk.
Hide
Adrian Mester added a comment -

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

link

Show
Adrian Mester added a comment - The patch seems to not have made it in the 1.11.10 release link
Hide
Bart McLeod added a comment -

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.

Show
Bart McLeod added a comment - 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.
Hide
Bart McLeod added a comment -

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.

Show
Bart McLeod added a comment - 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.
Hide
Bart McLeod added a comment - - edited

'Affects versions' field updated to '1.11.10'

Show
Bart McLeod added a comment - - edited 'Affects versions' field updated to '1.11.10'

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: