so as the title says I am getting an error in Laravel 5.5 in production
unserialize(): Error at offset 0 of 61 bytes
This however has not been happening before. It started to happen a week ago.
When user (guest) clicks on a button an ajax request is sent to the server that creates a cookie for user, saves it to DB and saves it to users browser
If the user is not authenticated and his cookie is not yet created, this code executes.
$hash = randHash(20);
// Cookie is saved into DB
Cookie::queue('Posts', $hash, 45000);
And afterwards there is a middleware on server which executes on every request.
if($cookie = Cookie::get('Posts')){
$cookie = Crypt::decrypt($cookie);
// Rest of code
}
The problem is that a week ago, newest cookies became unable to be unserialized. After I inspected it closer I found out this:
I decrypted the cookie without unserializing it and instead of looking like this:
s:20:"Cookie";
it looked like this:
SomeRandomString|Cookie
and as you can see, the second option can not be deserialized. I honestly have no idea how to fix this.
Here are some things that I tried or saw:
- Clearing sessions and caches - Did not work
- key:generate - Unable to do this, since it is in production
- $serialize variable in EncryptCookies to false - I am working in Laravel 5.5
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3fbLaTB
via IFTTT
Aucun commentaire:
Enregistrer un commentaire