From 0a723106c2fa87c2255656a656a3404d6f140f9e Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 17 May 2024 16:51:26 +0100 Subject: [PATCH] Fixes engine resolvers leaking memory --- src/Illuminate/View/ViewServiceProvider.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/View/ViewServiceProvider.php b/src/Illuminate/View/ViewServiceProvider.php index c40c3b9fc5bb..bfdc27ac7e41 100755 --- a/src/Illuminate/View/ViewServiceProvider.php +++ b/src/Illuminate/View/ViewServiceProvider.php @@ -135,7 +135,7 @@ public function registerEngineResolver() public function registerFileEngine($resolver) { $resolver->register('file', function () { - return new FileEngine($this->app['files']); + return new FileEngine(app()->make('files')); }); } @@ -148,7 +148,7 @@ public function registerFileEngine($resolver) public function registerPhpEngine($resolver) { $resolver->register('php', function () { - return new PhpEngine($this->app['files']); + return new PhpEngine(app()->make('files')); }); } @@ -161,9 +161,14 @@ public function registerPhpEngine($resolver) public function registerBladeEngine($resolver) { $resolver->register('blade', function () { - $compiler = new CompilerEngine($this->app['blade.compiler'], $this->app['files']); + $app = app(); - $this->app->terminating(static function () use ($compiler) { + $compiler = new CompilerEngine( + $app->make('blade.compiler'), + $app->make('files'), + ); + + $app->terminating(static function () use ($compiler) { $compiler->forgetCompiledOrNotExpired(); });