zendframework/zf2 — pull request #6448 by Seanymack9 (2014-07-09 16:34:42+00:00)
Title: AbstractRestfulController returns arrays for non overridden functions

Currently the AbstractRestfulController returns an array when the RESTful function which has been called has not been overridden.

By just returning an array the PhpRenderer attempts to create a ViewModel and therefore tries to load a template that has not been specified. This results in the following exception:
"Zend\View\Renderer\PhpRenderer::render: Unable to render template "X"; resolver could not resolve to a file"

The change is to check if the return value is an array and then convert this to a JsonModel so it will return a JSON object containing the message "Method Not Allowed".