Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 - unserialize(): Error at offset 0 of 32 bytes

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!

like image 511
user2094178 Avatar asked May 31 '13 17:05

user2094178


1 Answers

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.

like image 90
Dwight Avatar answered Sep 29 '22 19:09

Dwight