Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1cadf0

Browse filesBrowse files
bug #21976 [VarDumper] Add missing isset() checks in some casters (nicolas-grekas)
This PR was merged into the 2.8 branch. Discussion ---------- [VarDumper] Add missing isset() checks in some casters | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 870c26f [VarDumper] Add missing isset() checks in some casters
2 parents 25a2ce0 + 870c26f commit d1cadf0
Copy full SHA for d1cadf0

File tree

1 file changed

+14
-10
lines changed
Filter options

1 file changed

+14
-10
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/ExceptionCaster.php
+14-10Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ public static function castThrowingCasterException(ThrowingCasterException $e, a
6767

6868
if (isset($a[$xPrefix.'previous'], $a[$xPrefix.'trace'])) {
6969
$b = (array) $a[$xPrefix.'previous'];
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-
));
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+
}
7577
$a[$xPrefix.'trace'] = new TraceStub($b[$xPrefix.'trace'], false, 0, -1 - count($a[$xPrefix.'trace']->value));
7678
}
7779

@@ -234,11 +236,13 @@ private static function filterExceptionArray($xClass, array $a, $xPrefix, $filte
234236
}
235237

236238
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
237-
array_unshift($trace, array(
238-
'function' => $xClass ? 'new '.$xClass : null,
239-
'file' => $a[Caster::PREFIX_PROTECTED.'file'],
240-
'line' => $a[Caster::PREFIX_PROTECTED.'line'],
241-
));
239+
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
240+
array_unshift($trace, array(
241+
'function' => $xClass ? 'new '.$xClass : null,
242+
'file' => $a[Caster::PREFIX_PROTECTED.'file'],
243+
'line' => $a[Caster::PREFIX_PROTECTED.'line'],
244+
));
245+
}
242246
$a[$xPrefix.'trace'] = new TraceStub($trace, self::$traceArgs);
243247
}
244248
if (empty($a[$xPrefix.'previous'])) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.