Coding error: Failed to unserialise data

Coding error: Failed to unserialise data

Porsa Barnam
Number of replies: 1

Hi.

I have some problem with Moodle on my localhost.

When requesting Moodle in the web browser, an error is shown.

The error is:

Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.

With this noticed text:

fread(): read of xxxx bytes failed with errno=22 Invalid argument in \lib.php on line xxx

 

The code (in lib.php) specified in the above notice is:

            $data .= fread($handle, xxxxx);

Which is a line of the below piece of code:

// Read the data in 1Mb chunks. Small caches will not loop more than once.  We don't use filesize as it may

        // be cached with a different value than what we need to read from the file.

        do {

            $data .= fread($handle, 1048576);

        } while (!feof($handle));

 

With this error, even the login page is not accessible and I can’t go to any page of LMS (including site administration).

 

The version of installed Moodle is 4.0 and it’s been installed on a Xampp server on Windows.

 

I appreciate any guidance to solve the problem.

평균 등급 : -
In reply to Porsa Barnam

Re: Coding error: Failed to unserialise data

Mosaab Alsiddig
I had the same error and I fixed it by purging the cache from command line

php admin/cli/purge_caches.php