Skip to content

Conversation

@nunomaduro
Copy link
Member

This pull request fixes view engine resolvers leaking app instance in Octane: laravel/octane#887.

Note that I've spend a few time trying to write tests for this; but is not easy with our current Octane setup.

@driesvints This needs to be merged on 11.x.

@nunomaduro nunomaduro requested a review from taylorotwell May 17, 2024 15:59
@taylorotwell taylorotwell merged commit 087bf14 into 10.x May 17, 2024
@taylorotwell taylorotwell deleted the chore/view-engine-resolvers-leaking-memory branch May 17, 2024 16:01
{
$resolver->register('blade', function () {
$compiler = new CompilerEngine($this->app['blade.compiler'], $this->app['files']);
$app = app();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driesvints @nunomaduro

As the app() helper is pulled from the Foundation component, doesn't the View component's composer.json file need to be updated to account for that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option is to call Container::getInstance() as the app() helper basically does only that, and the Container component is already required by the view component.

For the other usage, Container::getInstance()->make($dependency) can be used.

function app($abstract = null, array $parameters = [])
{
if (is_null($abstract)) {
return Container::getInstance();
}
return Container::getInstance()->make($abstract, $parameters);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants