diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d2a186904407..19e95cff1f99 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: true matrix: - php: [7.2, 7.3, 7.4, 8.0] + php: ['7.2', '7.3', '7.4', '8.0'] stability: [prefer-lowest, prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} @@ -78,7 +78,7 @@ jobs: strategy: fail-fast: true matrix: - php: [7.2, 7.3, 7.4, 8.0] + php: ['7.2', '7.3', '7.4', '8.0'] stability: [prefer-lowest, prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 35348d53f62b..648a0cd2f21a 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '6.20.14'; + const VERSION = '6.20.15'; /** * The base path for the Laravel installation. diff --git a/src/Illuminate/View/Engines/CompilerEngine.php b/src/Illuminate/View/Engines/CompilerEngine.php index 03717bad0b51..cf6dac70e8a1 100755 --- a/src/Illuminate/View/Engines/CompilerEngine.php +++ b/src/Illuminate/View/Engines/CompilerEngine.php @@ -2,9 +2,9 @@ namespace Illuminate\View\Engines; -use ErrorException; use Exception; use Illuminate\View\Compilers\CompilerInterface; +use Illuminate\View\ViewException; class CompilerEngine extends PhpEngine { @@ -74,7 +74,7 @@ public function get($path, array $data = []) */ protected function handleViewException(Exception $e, $obLevel) { - $e = new ErrorException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); + $e = new ViewException($this->getMessage($e), 0, 1, $e->getFile(), $e->getLine(), $e); parent::handleViewException($e, $obLevel); } diff --git a/src/Illuminate/View/ViewException.php b/src/Illuminate/View/ViewException.php new file mode 100644 index 000000000000..9c9463bc28ac --- /dev/null +++ b/src/Illuminate/View/ViewException.php @@ -0,0 +1,37 @@ +getPrevious(); + + if ($exception && method_exists($exception, 'report')) { + $exception->report(); + } + } + + /** + * Render the exception into an HTTP response. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function render($request) + { + $exception = $this->getPrevious(); + + if ($exception && method_exists($exception, 'render')) { + return $exception->render($request); + } + } +} diff --git a/tests/Integration/View/RenderableViewExceptionTest.php b/tests/Integration/View/RenderableViewExceptionTest.php new file mode 100644 index 000000000000..93c91cb31387 --- /dev/null +++ b/tests/Integration/View/RenderableViewExceptionTest.php @@ -0,0 +1,36 @@ +get('/'); + + $response->assertSee('This is a renderable exception.'); + } + + protected function getEnvironmentSetUp($app) + { + $app['config']->set('view.paths', [__DIR__.'/templates']); + } +} + +class RenderableException extends Exception +{ + public function render($request) + { + return new Response('This is a renderable exception.'); + } +} diff --git a/tests/Integration/View/templates/renderable-exception.blade.php b/tests/Integration/View/templates/renderable-exception.blade.php new file mode 100644 index 000000000000..28649eefa7f9 --- /dev/null +++ b/tests/Integration/View/templates/renderable-exception.blade.php @@ -0,0 +1,3 @@ +@php + throw new Illuminate\Tests\Integration\View\RenderableException; +@endphp diff --git a/tests/View/fixtures/nested/basic.php b/tests/View/fixtures/nested/basic.php index 557db03de997..e69de29bb2d1 100755 --- a/tests/View/fixtures/nested/basic.php +++ b/tests/View/fixtures/nested/basic.php @@ -1 +0,0 @@ -Hello World