-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Action forwarding is not working if Exception is handled in the Controller's initialize() phase #12931
Comments
I believe this is fixed with PR #12209 (not merged) .. just need to rebase it and resubmit it. It fixes a bunch of looping and performance issues as well. |
will you be doing that any time soon? |
Yeah, it's on my todo list |
I bumped on this bug too. |
I hope you can fix this bug quickly, I can't continue doing my work because of this bug. |
Any update on this ticket? Is there some other dependency? |
…ling, forwarding, exceptions, bubbling and performance improvements. Fixes phalcon#12931
…ling, forwarding, exceptions, bubbling and performance improvements. Fixes phalcon#12931
…ling, forwarding, exceptions, bubbling and performance improvements. Fixes phalcon#12931
…ling, forwarding, exceptions, bubbling and performance improvements. Fixes phalcon#12931
@temuri416 Finally got around to this. Can you check: PR - #13112 This issue - In general, you can't use |
Fixed Dispatcher::dispatch() to ensure proper flow for all event handling, forwarding, exceptions, bubbling and performance improvements. Fixes #12931
Fixed in the |
…ling, forwarding, exceptions, bubbling and performance improvements. Fixes phalcon#12931
Hi,
I use this approach to handle exceptions thrown in Controller Actions. Nothing fancy here:
Everything works fine if an Exception is thrown inside Controller's Action, i.e. past this line:
https://github.com/phalcon/cphalcon/blob/master/phalcon/dispatcher.zep#L654
The problem is that if an Exception is thrown inside Controller's
initialize()
, then forwarding code above does not work (it does get executed).Looking at the code I see something that looks like an oversight to me. This is the code that handles Exception in the named action (link):
As you can see, an Exception is caught and
_handleException
is fired inside the dispatch loop, thus giving Dispatcher'sforward()
a chance to affect execution in subsequent iteration.And this is how Controller's
initialize
is called (link):So, if an Exception is thrown in
initialize
, the error bubbles up and out of the dispatch loop.So, shouldn't there be a try\catch around the initialize() call as well?
Thanks!
Details
php -v
) 7.1The text was updated successfully, but these errors were encountered: