Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a problem with Drupal 6.20.

Possibly after a PHP update, site stopped working. I get:

Notice: unserialize() [function.unserialize]: Error at offset 0 of 22765 bytes in /PATH/includes/cache.inc on line 33

This is the line:

$cache->data = unserialize($cache->data);

I would appreciate any help.

share|improve this question
Is this coming out of a database? Perhaps some additional chars have appeared in the serialized string during the upgrade. As @Udo G says best to post the result of var_dump($cache->data) up here. – Treffynnon Apr 11 '11 at 15:46
See : stackoverflow.com/a/10152996/1226894 – Baba Oct 3 '12 at 15:18

3 Answers

This problem will happen when you have Drupal 6.x running over PostgreSQL 9.0 because the bytea type was modified.
There are some suggested solutions here: http://postgresql.1045698.n5.nabble.com/Bytea-error-in-PostgreSQL-9-0-td3304087.html

Running this on the database should fix it:

ALTER DATABASE databasename SET bytea_output='escape';
share|improve this answer

Sounds like your Drupal cache has gotten corrupted.

The immediate solution would be to clear the caches. Three ways to clear the Drupal caches:

  1. Log in to the site with the admin password and select the flush caches option from the menu. This will obviously only be possible if you can get into the site in the first place.

  2. If you can't do that, you can use the Drush command-line utility to flush the cashes without having to go to the site.

  3. If you can't even get Drush to work (or you just don't want to install it), you can do it manually by going to the the database in your favourite MySQL tool, and emptying all the tables whose names start with the word "cache_".

The real question is why this would have happened in the first place. Sadly, I can't answer that, without a lot more info about your set up (and likely spending some time investigating too).

The danger is that even once you've cleared your cache, the same error could occur again, so even if you do get it working again, it would be a good idea to dig around a bit and see if you can find out the root cause.

My guess would be a rouge module that's got a bug has written bad data to the cache. You might want to check the drupal site and Google to check the modules you're using to see if there's any that have had similar behaviour reported.

Also, you mention a PHP update: Please let us know which versions of PHP you went from and to. There are known issues with some Drupal 6 modules in PHP 5.3, although the core does support it. See http://drupal.org/requirements for more info.

share|improve this answer
Did everything you have said, but didnt work. I have to delete cache every time before clicking link, however in optins cache is disabled. Besides, there are many psql-related errors... – user21897190 Apr 11 '11 at 16:41

Try a var_dump($cache->data). It could be that PHP is adding escape sequences and/or quotes due to magic quotes or similar.

share|improve this answer
I get a random sequence of letters/numbers stating with (its a really long string): string(22765) "x613 and it ends with: 3b7d" – user21897190 Apr 11 '11 at 15:44
To my knowledge any serialized data starts in the form "X:n" (and ends with ; or }) where X is the type and n is the length. Examples a:1, i:123. Apparently the $cache->data value is completely wrong. You should check where that data comes from. – Udo G Apr 11 '11 at 15:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.