Gaurav Sharma
Gaurav Sharma

Reputation: 2848

Error appearing in application after updating cakePHP library files from 1.3.0 to 1.3.1

I have just updated my cakephp library to latest version 1.3.1. Before this I was running v1.3.0 with no errors.

After running the application I am given this error message.

unserialize() [function.unserialize]: Error at offset 0 of 2574 bytes [CORE\cake\libs\cache\file.php, line 176]

I updated the libraries simply by replacing the existing cake files with the new ones downloaded from the net.

Is it the correct way of updating applications. I did'nt made any customizations to the core library of cakePHP.

What is the problem ?

Upvotes: 0

Views: 351

Answers (2)

Gaurav Sharma
Gaurav Sharma

Reputation: 2848

The link provided by dhofstet clearly explains and solves the problem, still posting an answer, so that anyone facing the same issue may not have to go outside of stackoverflow.

Open up the cakephp libs folder
path is
cake\libs
then open the file
file.php
go to line number 188
and add the following code in it
$data = trim($data); just after the following loop

while (!feof($this->handle)) {
        $data .= fgets($this->handle, 4096);
    }

like this

while (!feof($this->handle)) {
        $data .= fgets($this->handle, 4096);
    }
$data = trim($data);

This will solve the error completely.

Upvotes: 1

dhofstet
dhofstet

Reputation: 9964

I guess you encountered the following CakePHP bug (which has been fixed in the meantime): http://cakephp.lighthouseapp.com/projects/42648/tickets/769-unserialize-error-cakephp-131-unusable-on-windows

Upvotes: 1

Related Questions