Skip to content

Commit 9175d01

Browse files
[13.1] Fixed issue with Laravel 6 and 7 (#149)
1 parent bd95ce6 commit 9175d01

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ CHANGE LOG
22
==========
33

44

5+
## V13.1.1 (UPCOMING)
6+
7+
* Fixed issue with Laravel 6 and 7
8+
9+
510
## V13.1 (14/08/2020)
611

712
* Added Laravel 8 support

src/View/Engine/PathEvaluationTrait.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace GrahamCampbell\Markdown\View\Engine;
1515

16+
use Illuminate\Contracts\Filesystem\FileNotFoundException;
1617
use Illuminate\Filesystem\Filesystem;
1718
use Throwable;
1819

@@ -32,6 +33,8 @@ trait PathEvaluationTrait
3233
* @param string $path
3334
* @param array $data
3435
*
36+
* @throws \Throwable
37+
*
3538
* @return string
3639
*/
3740
protected function evaluatePath($path, $data)
@@ -44,7 +47,18 @@ protected function evaluatePath($path, $data)
4447
// flush out any stray output that might get out before an error occurs or
4548
// an exception is thrown. This prevents any partial views from leaking.
4649
try {
47-
(new Filesystem())->getRequire($path, $data);
50+
if (!(new Filesystem())->isFile($path)) {
51+
throw new FileNotFoundException("File does not exist at path {$path}.");
52+
}
53+
54+
$__path = $path;
55+
$__data = $data;
56+
57+
(static function () use ($__path, $__data) {
58+
extract($__data, EXTR_SKIP);
59+
60+
return require $__path;
61+
})();
4862
} catch (Throwable $e) {
4963
$this->handleViewException($e, $obLevel);
5064
}

0 commit comments

Comments
 (0)