{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zend-mvc/issues/100","repository_url":"https://api.github.com/repos/zendframework/zend-mvc","labels_url":"https://api.github.com/repos/zendframework/zend-mvc/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-mvc/issues/100/comments","events_url":"https://api.github.com/repos/zendframework/zend-mvc/issues/100/events","html_url":"https://github.com/zendframework/zend-mvc/issues/100","id":139824405,"number":100,"title":"parsing json can throw RuntimeException in AbstractRestfulController","user":{"login":"svycka","id":1270782,"avatar_url":"https://avatars.githubusercontent.com/u/1270782?v=3","gravatar_id":"","url":"https://api.github.com/users/svycka","html_url":"https://github.com/svycka","followers_url":"https://api.github.com/users/svycka/followers","following_url":"https://api.github.com/users/svycka/following{/other_user}","gists_url":"https://api.github.com/users/svycka/gists{/gist_id}","starred_url":"https://api.github.com/users/svycka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svycka/subscriptions","organizations_url":"https://api.github.com/users/svycka/orgs","repos_url":"https://api.github.com/users/svycka/repos","events_url":"https://api.github.com/users/svycka/events{/privacy}","received_events_url":"https://api.github.com/users/svycka/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-10T08:49:34Z","updated_at":"2016-04-13T13:25:22Z","closed_at":"2016-04-13T13:25:22Z","body":"in AbstractRestfulController here https://github.com/zendframework/zend-mvc/blob/ba5c1e124ba07965bfadc1abe2373431025e73db/src/Controller/AbstractRestfulController.php#L453 and https://github.com/zendframework/zend-mvc/blob/ba5c1e124ba07965bfadc1abe2373431025e73db/src/Controller/AbstractRestfulController.php#L576 can throw not catched exceptions leading to 500 response when header `Content-Type: application/json` and body is not valid json.\r\n\r\nIs this bug or not? if not how can I workaround this? The only way to silent this I see is to override these methods or https://github.com/zendframework/zend-mvc/blob/ba5c1e124ba07965bfadc1abe2373431025e73db/src/Controller/AbstractRestfulController.php#L311 but I am not sure I want this."},"comment":{"url":"https://api.github.com/repos/zendframework/zend-mvc/issues/comments/209439657","html_url":"https://github.com/zendframework/zend-mvc/issues/100#issuecomment-209439657","issue_url":"https://api.github.com/repos/zendframework/zend-mvc/issues/100","id":209439657,"user":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T13:25:22Z","updated_at":"2016-04-13T13:25:22Z","body":"@svycka At this point, it's the intended behavior; the `AbstractRestfulController` provides a convenience layer for the 80% use case.\r\n\r\nAnother option is to do the validation *earlier*, which is what Apigility does. In zf-content-negotiation, we have a route listener (on negative priority; runs once we know what route was matched) that does the body parameter parsing. This allows us to return a 400 response when we have JSON decoding errors."}}