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

Dispatch error should be preventable #6024

Conversation

Ocramius
Copy link
Member

Please see the tests.

It is currently impossible for a listener of Zend\Mvc\MvcEvent::EVENT_DISPATCH_ERROR to do following:

$event->setError(''); // resetting app state (not an error)
$event->setRouteMatch(...); // setting a route match (allows for redirecting to a controller in case of routing failure)
$event->stopPropagation();

This PR fixes that

@Ocramius
Copy link
Member Author

@weierophinney assigning you since you probably know why that early return $this; was in place.

@@ -306,7 +306,6 @@ public function run()
if ($event->getError()) {
return $this->completeRequest($event);
}
Copy link
Member

Choose a reason for hiding this comment

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

I'd argue that if we're not going to return out of the parent conditional, this conditional can be removed, as it's repeated immediately below.

@weierophinney
Copy link
Member

@weierophinney assigning you since you probably know why that early return $this; was in place.

Honestly, I cannot quite remember. On review today, I don't see any good reason why, and clearly that use case is not covered by the tests, as your change doesn't lead to new failures.

@weierophinney weierophinney added this to the 2.3.1 milestone Apr 14, 2014
weierophinney added a commit that referenced this pull request Apr 14, 2014
…ld-be-preventable

Dispatch error should be preventable
weierophinney added a commit that referenced this pull request Apr 14, 2014
weierophinney added a commit that referenced this pull request Apr 14, 2014
@weierophinney weierophinney merged commit bb0be6d into zendframework:master Apr 14, 2014
weierophinney added a commit that referenced this pull request Apr 14, 2014
@Ocramius Ocramius deleted the hotfix/mvc-dispatch-error-should-be-preventable branch April 14, 2014 15:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants