Revert "bug #17052 [2.7] Fixed flatten exception recursion with errors (GrahamCampbell)"
This reverts commitaf3f4eaa2b
, reversing changes made to021ab8a7b3
.
This commit is contained in:
parent
7660fb8c89
commit
e60889ac4d
@ -94,13 +94,8 @@ class FlattenException extends LegacyFlattenException
|
|||||||
$e->setClass(get_class($exception));
|
$e->setClass(get_class($exception));
|
||||||
$e->setFile($exception->getFile());
|
$e->setFile($exception->getFile());
|
||||||
$e->setLine($exception->getLine());
|
$e->setLine($exception->getLine());
|
||||||
|
if ($exception->getPrevious()) {
|
||||||
$previous = $exception->getPrevious();
|
$e->setPrevious(static::create($exception->getPrevious()));
|
||||||
|
|
||||||
if ($previous instanceof \Exception) {
|
|
||||||
$e->setPrevious(static::create($previous));
|
|
||||||
} elseif ($previous instanceof \Throwable) {
|
|
||||||
$e->setPrevious(static::create(new FatalThrowableError($previous)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $e;
|
return $e;
|
||||||
|
@ -131,20 +131,6 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertSame(array($flattened2), $flattened->getAllPrevious());
|
$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
|
* @dataProvider flattenDataProvider
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user