From e60889ac4d85e6ec1083ab95dc84b2b3c0a95dd6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 26 Dec 2015 15:02:40 +0100 Subject: [PATCH] Revert "bug #17052 [2.7] Fixed flatten exception recursion with errors (GrahamCampbell)" This reverts commit af3f4eaa2b37bca77274b670e96a695f3e46c4e5, reversing changes made to 021ab8a7b35cac053442124e04cd87e2e1ef43cd. --- .../Component/Debug/Exception/FlattenException.php | 9 ++------- .../Debug/Tests/Exception/FlattenExceptionTest.php | 14 -------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/Symfony/Component/Debug/Exception/FlattenException.php b/src/Symfony/Component/Debug/Exception/FlattenException.php index aca4611377..14f5d1ea1d 100644 --- a/src/Symfony/Component/Debug/Exception/FlattenException.php +++ b/src/Symfony/Component/Debug/Exception/FlattenException.php @@ -94,13 +94,8 @@ class FlattenException extends LegacyFlattenException $e->setClass(get_class($exception)); $e->setFile($exception->getFile()); $e->setLine($exception->getLine()); - - $previous = $exception->getPrevious(); - - if ($previous instanceof \Exception) { - $e->setPrevious(static::create($previous)); - } elseif ($previous instanceof \Throwable) { - $e->setPrevious(static::create(new FatalThrowableError($previous))); + if ($exception->getPrevious()) { + $e->setPrevious(static::create($exception->getPrevious())); } return $e; diff --git a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php index 6c570e235d..99eaf497d5 100644 --- a/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php +++ b/src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php @@ -131,20 +131,6 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase $this->assertSame(array($flattened2), $flattened->getAllPrevious()); } - /** - * @requires PHP 7.0 - */ - public function testPreviousError() - { - $exception = new \Exception('test', 123, new \ParseError('Oh noes!', 42)); - - $flattened = FlattenException::create($exception)->getPrevious(); - - $this->assertEquals($flattened->getMessage(), 'Parse error: Oh noes!', 'The message is copied from the original exception.'); - $this->assertEquals($flattened->getCode(), 42, 'The code is copied from the original exception.'); - $this->assertEquals($flattened->getClass(), 'Symfony\Component\Debug\Exception\FatalThrowableError', 'The class is set to the class of the original exception'); - } - /** * @dataProvider flattenDataProvider */