Skip to content

Commit d49d901

Browse files
committed
[11.x] Fix handling exceptions thrown in eval()'d code
1 parent 5c9cb78 commit d49d901

File tree

1 file changed

+6
-0
lines changed
  • src/Illuminate/Foundation/Exceptions/Renderer

1 file changed

+6
-0
lines changed

src/Illuminate/Foundation/Exceptions/Renderer/Frame.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public function file()
106106
*/
107107
public function line()
108108
{
109+
if (! (\is_file($this->frame['file']) && is_readable($this->frame['file']))) {
110+
return 0;
111+
}
109112
$maxLines = count(file($this->frame['file']) ?: []);
110113

111114
return $this->frame['line'] > $maxLines ? 1 : $this->frame['line'];
@@ -131,6 +134,9 @@ public function callable()
131134
*/
132135
public function snippet()
133136
{
137+
if (! (\is_file($this->frame['file']) && is_readable($this->frame['file']))) {
138+
return '';
139+
}
134140
$contents = file($this->frame['file']) ?: [];
135141

136142
$start = max($this->line() - 6, 0);

0 commit comments

Comments
 (0)