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
-
Laravel Version
11.22.0
PHP Version
8.2.16
Database Driver & Version
No response
Description
We are using the new
ContextualAttribute
to get theCurrentUser
in our controller methods. This works fine, until there is no user in the guard.The function
resolve
in the attribute correctly returnsnull
, but theContainer
then resolves the parameter to a newUser
instance if there is a type-hint for aUser
on 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
$user
will contain an empty model.Beta Was this translation helpful? Give feedback.
All reactions