Issue4817 #4818

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
3 participants
@tylkomat

Fix for #4817

@mwillbanks

This comment has been minimized.

Show comment Hide comment
@mwillbanks

mwillbanks Jul 12, 2013

Contributor

Could you please provide some more detail in this PR? I did look at the other issue but some sources and other items would be great :)

Contributor

mwillbanks commented Jul 12, 2013

Could you please provide some more detail in this PR? I did look at the other issue but some sources and other items would be great :)

@tylkomat

This comment has been minimized.

Show comment Hide comment
@tylkomat

tylkomat Jul 12, 2013

Ah sure. Following this specification www.jsonrpc.org/specification the Error Code for a parse error should be -32700. This error should be sent when the JSON sent to the service is malformed. An example from the same page:
A request {"jsonrpc": "2.0", "method": "foobar, "params": "bar", "baz] should create this response: {"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}

Before my PR the JSON parser just threw an unhandled exception which in this case is not desired and should be handled. Like the already existing isMethodError function I created an ìsParseError function so the Zend\Json\Server\Server can check in the Zend\Json\Server\Request object for it and create a proper Zend\Json\Server\Response.

Ah sure. Following this specification www.jsonrpc.org/specification the Error Code for a parse error should be -32700. This error should be sent when the JSON sent to the service is malformed. An example from the same page:
A request {"jsonrpc": "2.0", "method": "foobar, "params": "bar", "baz] should create this response: {"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null}

Before my PR the JSON parser just threw an unhandled exception which in this case is not desired and should be handled. Like the already existing isMethodError function I created an ìsParseError function so the Zend\Json\Server\Server can check in the Zend\Json\Server\Request object for it and create a proper Zend\Json\Server\Response.

@ghost ghost assigned weierophinney Jul 17, 2013

weierophinney added a commit that referenced this pull request Jul 17, 2013

weierophinney added a commit that referenced this pull request Jul 17, 2013

weierophinney added a commit to zendframework/zend-json that referenced this pull request May 15, 2015

weierophinney added a commit to zendframework/zend-json that referenced this pull request May 15, 2015

weierophinney added a commit to zendframework/zend-json that referenced this pull request May 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment