[Console] Fix restoring exception handler#25753
Conversation
nicolas-grekas
commented
Jan 10, 2018
| Q | A |
|---|---|
| Branch? | 3.4 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | ,p |
| Tests pass? | yes |
| Fixed tickets | #25718 |
| License | MIT |
| Doc PR | - |
dbu
left a comment
There was a problem hiding this comment.
looks reasonable to me. though i think some doc comments would really help here to understand why/what we do here.
| } | ||
| } finally { | ||
| if (!$phpHandler) { | ||
| if (set_exception_handler($renderException) === $renderException) { |
There was a problem hiding this comment.
I agree with @dbu to either add comments or extract some private methods. Also I don't get how this solves the problem. From how I understood #25718, the Kernel exception handler is set after the console one. So set_exception_handler($renderException) === $renderException is not true. And even if it is true, this block only sets an exception handler that is then removed again?
There was a problem hiding this comment.
I think the code is correct. The only way to learn the current handler is to overwrite it. If condition is true, we pop it out again. Then either way we pop one more time. If condition was true, that removes the actual handler, otherwise it pops the thing we set to learn what handler was set.
|
I would happily add a comment, but I've no inspiration (maybe because I feel like the code is enough...) |
2489487 to
0096449
Compare
|
Thank you @fancyweb. |
… fancyweb) This PR was merged into the 3.4 branch. Discussion ---------- [Console] Fix restoring exception handler | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | ,p | Tests pass? | yes | Fixed tickets | #25718 | License | MIT | Doc PR | - Commits ------- 0096449 [Console] Keep the modified exception handler 3fa1ad9 [Console] Fix restoring exception handler