Replies: 2 comments
-
|
This could also potentially "break" some edge cases in the new features from this PR: #53080 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Any fixes? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
11.22.0
PHP Version
8.2.16
Database Driver & Version
No response
Description
We are using the new
ContextualAttributeto get theCurrentUserin our controller methods. This works fine, until there is no user in the guard.The function
resolvein the attribute correctly returnsnull, but theContainerthen resolves the parameter to a newUserinstance if there is a type-hint for aUseron the parameter. This even happens when the parameter type is indicated as optional.Steps To Reproduce
When executing this code without being logged in (having no available user), the
$userwill contain an empty model.Beta Was this translation helpful? Give feedback.
All reactions