Skip to content

Commit

Permalink
Fixes engine resolvers leaking memory (#51450)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro authored May 17, 2024
1 parent 010b548 commit 087bf14
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Illuminate/View/ViewServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});
}

Expand All @@ -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'));
});
}

Expand All @@ -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();
});

Expand Down

0 comments on commit 087bf14

Please sign in to comment.