Skip to content

Commit 252ff9e

Browse files
committed
Check trace
1 parent 5b81fdb commit 252ff9e

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

app/Http/Controllers/WorkflowsController.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public function show($id) {
4444
$flow->exceptions = $flow->exceptions->map(function ($exception) {
4545
$exception->code ??= null;
4646
$unserialized = Y::unserialize($exception->exception);
47-
if (is_array($unserialized) && array_key_exists('class', $unserialized) && is_subclass_of($unserialized['class'], \Throwable::class)) {
47+
if (is_array($unserialized)
48+
&& array_key_exists('class', $unserialized)
49+
&& is_subclass_of($unserialized['class'], \Throwable::class)
50+
&& file_exists($unserialized['file'])
51+
) {
4852
$file = new SplFileObject($unserialized['file']);
4953
$file->seek($unserialized['line'] - 4);
5054
for ($line = 0; $line < 7; ++$line) {
@@ -54,22 +58,6 @@ public function show($id) {
5458
}
5559
$exception->code = rtrim($exception->code);
5660
$exception->exception = serialize($unserialized);
57-
} else {
58-
if (is_object($unserialized) && method_exists($unserialized, 'getFile')) {
59-
$file = new SplFileObject($unserialized->getFile());
60-
$file->seek($unserialized->getLine() - 4);
61-
for ($line = 0; $line < 7; ++$line) {
62-
$exception->code .= $file->current();
63-
$file->next();
64-
if ($file->eof()) break;
65-
}
66-
$exception->code = rtrim($exception->code);
67-
try {
68-
$unserialized->trace = $unserialized->getTrace();
69-
} catch (\Throwable $th) {
70-
}
71-
}
72-
$exception->exception = serialize($unserialized);
7361
}
7462
return $exception;
7563
});

0 commit comments

Comments
 (0)