-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Encrypter contract has no getKey() method #38772
Comments
Yeah, this is an issue. I'm not sure how to resolve this properly as you don't really want the |
Why not just inject the key value to the EncryptCookies middleware via the constructor (the same way the encrypter gets its key) ? That seems to be the cleanest approach (especially since the CookieValuePrefix class has only static methods). |
@X-Coder264 because I believe in an ideal scenario, the key is encapsulated in an framework class rather than provided directly to the Middleware. |
It's provided directly as a string to the encrypter too. It'd be nice to have it as a class there too then. |
@X-Coder264 no, it's already wrapped in a class there. The encrypter itself. |
I don't know what's your definition of "wrapped" but it's different than mine. My idea of wrapped would be to create a |
Yeah maybe. Could be a good idea indeed. |
#38793 (comment) I think it is worth mentioning that adding |
@smknstd I think you can just return an empty string in that case. |
Description:
As reported by @denis-chmel here, contract
\Illuminate\Contracts\Encryption\Encrypter
has no public getKey() method declared and it probably should as EncryptCookies uses it since this fix.https://github.com/laravel/framework/blob/8.x/src/Illuminate/Cookie/Middleware/EncryptCookies.php#L86
https://github.com/laravel/framework/blob/8.x/src/Illuminate/Cookie/Middleware/EncryptCookies.php#L148
What do you think ?
The text was updated successfully, but these errors were encountered: