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

[11.x] Fix extensions of contextual bindings #53514

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

axlon
Copy link
Contributor

@axlon axlon commented Nov 14, 2024

Fixes #53501

Right now, Laravel always marks a binding as resolved when its done resolving them, even if the binding in question was a contextual binding. When extending bindings Laravel will check if a binding was resolved, and if it was it will retrieve it and extend it.

The problem here is that if a binding is only contextual, it cannot be resolved, but the framework will still attempt to. This PR aims to fix this by only marking bindings as resolved when they aren't contextual. This allows contextual bindings and extensions to work together in the event where the extension happens after the contextual binding is resolved (it already worked without the binding being resolved before the extension)

@taylorotwell taylorotwell merged commit 377ba1d into laravel:11.x Nov 14, 2024
33 checks passed
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.

Container::extend() breaks when $abstract was previously contextually bound
2 participants