Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Dispatching to a good controller but wrong action triggers a Fatal Error #3186

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions library/Zend/Mvc/Controller/AbstractActionController.php
Expand Up @@ -51,6 +51,9 @@ public function notFoundAction()
$event = $this->getEvent(); $event = $this->getEvent();
$routeMatch = $event->getRouteMatch(); $routeMatch = $event->getRouteMatch();


if($response instanceof \Zend\Console\Response) {
return null;
}
$response->setStatusCode(404); $response->setStatusCode(404);
$routeMatch->setParam('action', 'not-found'); $routeMatch->setParam('action', 'not-found');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test is wrong. We still want the route match change; we simply want to not set the status code, unless we have an HTTP response.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to return a ViewModel ? I can move the routeMatch or conditionally set the status code + return the ViewModel on \Zend\Http\Response. Which one is preferable ?



Expand Down