Skip to content

Commit bd8aa37

Browse files
authored
fix trace when file and line not set
1 parent 9e91e1e commit bd8aa37

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

core/src/ExceptionHandler.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,16 @@ protected function prepareBacktrace($backtrace)
451451
if (substr($val['function'], 0, 8) === 'phpError') {
452452
break;
453453
}
454-
$path = str_replace('\\', '/', $val['file']);
455-
if (strpos($path, MODX_BASE_PATH) === 0) {
456-
$path = substr($path, strlen(MODX_BASE_PATH));
454+
455+
if (isset($val['file'])) {
456+
$path = str_replace('\\', '/', $val['file']);
457+
if (strpos($path, MODX_BASE_PATH) === 0) {
458+
$path = substr($path, strlen(MODX_BASE_PATH));
459+
}
460+
} else {
461+
$path ='';
457462
}
463+
458464
switch (get_by_key($val, 'type')) {
459465
case '->':
460466
case '::':
@@ -516,7 +522,7 @@ protected function prepareBacktrace($backtrace)
516522
'func' => $functionName,
517523
'args' => $args,
518524
'path' => $path,
519-
'line' => $val['line'],
525+
'line' => $val['line'] ?? '',
520526
];
521527
}
522528

0 commit comments

Comments
 (0)