Laravel 4 - unserialize (): error with offset 0 out of 32 bytes

When I install Laravel 4, I get this error:

ErrorException unserialize(): Error at offset 0 of 32 bytes C:\xampp\htdocs\blog\laravel\bootstrap\compiled.php return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv))); 

If I modify return as follows:

 return unserialize(base64_decode($this->stripPadding($this->mcryptDecrypt($value, $iv)))); 

Then the error will disappear. But, of course, every time I launch an update for the composer, this change will be undone.

What is the cause of this problem?

I appreciate any help.

Update: This happens when I use Auth :: check ().

Update 2: Now it only works with remote base64_decode (). It looks like the xampp installation has become presumptuous. Jesus!

+6
source share
4 answers

Refer to this problem: laravel / framework # 1526

The reason is a change in the encryption mechanism. My solution was to unload the sessions and views tags that were cached in the storage folder, then run php artisan key:generate and restart the server. I'm not sure which part of the process fixed the problem, but I have not seen it since.

+20
source

Command> php artisan cache: the kernel fixed the problem for me. I do not need to restart the server

+1
source

Can you post what you do that causes this error? You should not change the kernel - because, as you said, updates will overwrite it.

0
source

You must install the news key, use the following command:

 php artisan key:generate 

After this test, run the Laravel application again

 php artisan serve 
0
source

Source: https://habr.com/ru/post/1483844/


All Articles