[HttpKernel] Fix possible infinite loop of exceptions
This commit is contained in:
parent
4b5661769d
commit
3447222b68
@ -56,13 +56,12 @@ class ExceptionListener implements EventSubscriberInterface
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', \get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()));
|
$this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', \get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()));
|
||||||
|
|
||||||
$wrapper = $e;
|
$prev = $e;
|
||||||
|
do {
|
||||||
while ($prev = $wrapper->getPrevious()) {
|
|
||||||
if ($exception === $wrapper = $prev) {
|
if ($exception === $wrapper = $prev) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
} while ($prev = $wrapper->getPrevious());
|
||||||
|
|
||||||
$prev = new \ReflectionProperty($wrapper instanceof \Exception ? \Exception::class : \Error::class, 'previous');
|
$prev = new \ReflectionProperty($wrapper instanceof \Exception ? \Exception::class : \Error::class, 'previous');
|
||||||
$prev->setAccessible(true);
|
$prev->setAccessible(true);
|
||||||
|
Reference in New Issue
Block a user