[HttpKernel] Fix possible infinite loop of exceptions

This commit is contained in:
Jáchym Toušek 2019-02-21 12:47:58 +01:00
parent 4b5661769d
commit 3447222b68
No known key found for this signature in database
GPG Key ID: 8722609474E4A4CD
1 changed files with 3 additions and 4 deletions

View File

@ -56,13 +56,12 @@ class ExceptionListener implements EventSubscriberInterface
} 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()));
$wrapper = $e;
while ($prev = $wrapper->getPrevious()) {
$prev = $e;
do {
if ($exception === $wrapper = $prev) {
throw $e;
}
}
} while ($prev = $wrapper->getPrevious());
$prev = new \ReflectionProperty($wrapper instanceof \Exception ? \Exception::class : \Error::class, 'previous');
$prev->setAccessible(true);