-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Prevent a fatal error when DebugHandlersListener is used with a kernel with no terminateWithException() method #17819
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
[HttpKernel] Prevent a fatal error when DebugHandlersListener is used with a kernel with no terminateWithException() method #17819
Conversation
@@ -93,7 +93,9 @@ public function configure(Event $event = null) | |||
} | |||
if (!$this->exceptionHandler) { | |||
if ($event instanceof KernelEvent) { | |||
$this->exceptionHandler = array($event->getKernel(), 'terminateWithException'); | |||
if (is_callable(array($event->getKernel(), 'terminateWithException'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IHMO, method_exists would be more straightforward here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it return true
if the method was private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but I'd say we don't care, we already use method_exists in the code base and that doesn't cause any issue I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and is_callable
would return true as soon there is __call
even though the implementation does not support it, so it is not a silver-bullet either.
… with a kernel with no terminateWithException() method
b774445
to
2849152
Compare
👍 failures look unrelated |
👍 Status: Reviewed |
Thank you @jakzal. |
…ner is used with a kernel with no terminateWithException() method (jakzal) This PR was merged into the 2.7 branch. Discussion ---------- [HttpKernel] Prevent a fatal error when DebugHandlersListener is used with a kernel with no terminateWithException() method | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - I just suffered from this bug on a project that used HttpKernelInterface implementation with no `terminateWithException() method (which is not part of the interface). Commits ------- 2849152 [HttpKernel] Prevent a fatal error when DebugHandlersListener is used with a kernel with no terminateWithException() method
I just suffered from this bug on a project that used HttpKernelInterface implementation with no `terminateWithException() method (which is not part of the interface).