Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

beforeException dispatcher forward not works on exception from plugin #12542

Closed
tugrul opened this issue Jan 12, 2017 · 5 comments
Closed

beforeException dispatcher forward not works on exception from plugin #12542

tugrul opened this issue Jan 12, 2017 · 5 comments
Assignees

Comments

@tugrul
Copy link
Contributor

tugrul commented Jan 12, 2017

Expected and Actual Behavior

dispatcher not dispatching forwarded action from beforeException event.

https://github.com/tugrul/invo/commit/2ad34a0ef102b9509ae86000cdcc6c7a4374325d

beforeException able to handle that exception but $dispatcher->forward() not works

https://github.com/tugrul/invo/blob/master/app/plugins/NotFoundPlugin.php#L41

Details

  • Phalcon version: 3.0.2
  • PHP Version: PHP 7.0.14-1~dotdeb+8.1
  • Operating System: Debian 8
  • Installation type: Compiling from source
  • Server: Nginx + PHP-FPM
@guweigang
Copy link
Contributor

guweigang commented Jul 27, 2017

HI, I also met this problem today in Phalcon 3.2.0. You can dispatch() it yourself after forward() like this:

$dispatcher->forward(array(
         'controller' => 'error',
         'action'       => 'showUnknown',
         'params'     => [$exception],
));
$dispatcher->dispatch();
return false;

Or you can change codes in https://github.com/phalcon/cphalcon/blob/master/phalcon/dispatcher.zep#L656 to

if this->{"_handleException"}(e) === false {
	continue;
} elseif this->_finished === false {
        continue;
} else {
	throw e;
}

Maybe that is the true purpose in catche @sergeyklay .

Sent from my OnePlus ONEPLUS A5000 using FastHub

@sergeyklay sergeyklay self-assigned this Jul 27, 2017
@guweigang
Copy link
Contributor

guweigang commented Jul 29, 2017

any progress? @sergeyklay

Sent from my OnePlus ONEPLUS A5000 using FastHub

@virgofx
Copy link
Contributor

virgofx commented Jul 30, 2017

Related to #12931. We have a PR that needs to rebase that fixes all the initialize/beforeException events.

@guweigang
Copy link
Contributor

@virgofx yes,We could not catch exceptions in actions here before, and now we can, but we can not process dispatcher->forward correctly

Sent from my OnePlus ONEPLUS A5000 using FastHub

@sergeyklay
Copy link
Contributor

Fixed in the 3.2.x branch. Feel free to open a new issue if the problem appears again. Thank you for contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants