Skip to content

Commit e60889a

Browse files
committed
Revert "bug #17052 [2.7] Fixed flatten exception recursion with errors (GrahamCampbell)"
This reverts commit af3f4ea, reversing changes made to 021ab8a.
1 parent 7660fb8 commit e60889a

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

src/Symfony/Component/Debug/Exception/FlattenException.php

+2-7
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,8 @@ public static function create(\Exception $exception, $statusCode = null, array $
9494
$e->setClass(get_class($exception));
9595
$e->setFile($exception->getFile());
9696
$e->setLine($exception->getLine());
97-
98-
$previous = $exception->getPrevious();
99-
100-
if ($previous instanceof \Exception) {
101-
$e->setPrevious(static::create($previous));
102-
} elseif ($previous instanceof \Throwable) {
103-
$e->setPrevious(static::create(new FatalThrowableError($previous)));
97+
if ($exception->getPrevious()) {
98+
$e->setPrevious(static::create($exception->getPrevious()));
10499
}
105100

106101
return $e;

src/Symfony/Component/Debug/Tests/Exception/FlattenExceptionTest.php

-14
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,6 @@ public function testPrevious(\Exception $exception, $statusCode)
131131
$this->assertSame(array($flattened2), $flattened->getAllPrevious());
132132
}
133133

134-
/**
135-
* @requires PHP 7.0
136-
*/
137-
public function testPreviousError()
138-
{
139-
$exception = new \Exception('test', 123, new \ParseError('Oh noes!', 42));
140-
141-
$flattened = FlattenException::create($exception)->getPrevious();
142-
143-
$this->assertEquals($flattened->getMessage(), 'Parse error: Oh noes!', 'The message is copied from the original exception.');
144-
$this->assertEquals($flattened->getCode(), 42, 'The code is copied from the original exception.');
145-
$this->assertEquals($flattened->getClass(), 'Symfony\Component\Debug\Exception\FatalThrowableError', 'The class is set to the class of the original exception');
146-
}
147-
148134
/**
149135
* @dataProvider flattenDataProvider
150136
*/

0 commit comments

Comments
 (0)