Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Bug fix related to extra calls to resolving callbacks (The other way) #27066

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ protected function getClosure($abstract, $concrete)
return $container->build($concrete);
}

return $container->make($concrete, $parameters);
// To prevent extra call to resolving callbacks, we make the object silently.
return $container->resolve($concrete, $parameters, true);
};
}

Expand Down Expand Up @@ -630,9 +631,10 @@ public function get($id)
*
* @param string $abstract
* @param array $parameters
* @param bool $silent
* @return mixed
*/
protected function resolve($abstract, $parameters = [])
protected function resolve($abstract, $parameters = [], $silent = false)
{
$abstract = $this->getAlias($abstract);

Expand Down Expand Up @@ -674,8 +676,9 @@ protected function resolve($abstract, $parameters = [])
$this->instances[$abstract] = $object;
}

$this->fireResolvingCallbacks($abstract, $object);

if (! $silent) {
$this->fireResolvingCallbacks($abstract, $object);
}
// Before returning, we will also set the resolved flag to "true" and pop off
// the parameter overrides for this build. After those two things are done
// we will be ready to return back the fully constructed class instance.
Expand Down
Loading