Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9fb17b4

Browse files
Merge branch '2.7' into 2.8
* 2.7: [VarDumper] ExceptionCaster robustness fix
2 parents 3c37037 + 6831b98 commit 9fb17b4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ public static function castThrowingCasterException(ThrowingCasterException $e, a
6565
$prefix = Caster::PREFIX_PROTECTED;
6666
$xPrefix = "\0Exception\0";
6767

68-
if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace'])) {
68+
if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace']) && $a[$xPrefix.'previous'] instanceof \Exception) {
6969
$b = (array) $a[$xPrefix.'previous'];
70-
if (isset($a[$prefix.'file'], $a[$prefix.'line'])) {
71-
array_unshift($b[$xPrefix.'trace'], array(
72-
'function' => 'new '.get_class($a[$xPrefix.'previous']),
73-
'file' => $b[$prefix.'file'],
74-
'line' => $b[$prefix.'line'],
75-
));
76-
}
70+
array_unshift($b[$xPrefix.'trace'], array(
71+
'function' => 'new '.get_class($a[$xPrefix.'previous']),
72+
'file' => $b[$prefix.'file'],
73+
'line' => $b[$prefix.'line'],
74+
));
7775
$a[$xPrefix.'trace'] = new TraceStub($b[$xPrefix.'trace'], false, 0, -1 - count($a[$xPrefix.'trace']->value));
7876
}
7977

0 commit comments

Comments
 (0)