Reputation: 9464
When I install Laravel 4, I receive 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 like this:
return unserialize(base64_decode($this->stripPadding($this->mcryptDecrypt($value, $iv))));
Then the error goes away. But of course every time I run composer update this change will be undone.
What could be the reason of this problem?
I appreciate any help.
Update: This only happens when I use Auth::check().
Update 2: Now it only works with base64_decode() removed. It's like if the xampp installation has become self-aware. Jesus!
Upvotes: 6
Views: 11868
Reputation: 890
You have to set a news Key, use the following command:
php artisan key:generate
After that test again to run the Laravel Application
php artisan serve
Upvotes: 0
Reputation: 19
The command > php artisan cache:clear fixed the problem for me. I did not have to restart the server
Upvotes: 1
Reputation: 12470
Refer to this issue: laravel/framework#1526
A change in the encryption mechanism is the cause. My solution was to empty out the sessions
and views
that were cached in the storage
folder, then run php artisan key:generate
and relaunch the server. I'm not sure which part of the process fixed the issue, but I haven't seen it since.
Upvotes: 21
Reputation: 9142
Can you post what you're doing that causes this error? You shouldn't be modifying the core - because as you said, updates will overwrite it.
Upvotes: 0