I've run into one of those unserialize errors, but haven't run into a post about this particular one:

Notice: unserialize() [function.unserialize]: Error at offset 2 of 77 bytes in
\includes\bootstrap.inc on line 478

Apache 2.2.11
PHP 5.2.8

Starting at line 478 of bootstrap.inc:

/**
 * Load the persistent variable table.
 *
 * The variable table is composed of values that have been saved in the table
 * with variable_set() as well as those explicitly specified in the configuration
 * file.
 */
function variable_init($conf = array()) {
  // NOTE: caching the variables improves performance by 20% when serving cached pages.
  if ($cached = cache_get('variables', 'cache')) {
    $variables = $cached->data;
  }
  else {
    $result = db_query('SELECT * FROM {variable}');
    while ($variable = db_fetch_object($result)) {
      $variables[$variable->name] = unserialize($variable->value); <<<< Line 478
    }
    cache_set('variables', $variables);
  }

  foreach ($conf as $name => $value) {
    $variables[$name] = $value;
  }

  return $variables;
} 

Is this a memory issue with PHP perhaps? Thoughts?

Comments

malcolmp’s picture

I have got the same problem, but I may have caused it myself by moving the site to a new host and trying to change all refs to the old url in the mysql database dump file (so it can't reserialize the variables because they are no longer the correct length)

mikespainhower’s picture

This is detailed at http://drupal.org/node/529866

sutch’s picture

Thanks for the link, gofrwd.

http://drupal.org/node/529866 does not contain details about how to find the improperly serialized variables. How have others located these variables?

vacilando’s picture

Same problem... strange that it started appearing only since Drupal 6.14!

Anonymous’s picture

I had this problem, and eventually traced it down to setting the wrong character set when I imported the db dump. I use Sequel Pro (Mac) to export and import this stuff. I set it to UTF 8 when I imported the .sql file and then I got the unserialize problems. So I nuked the db and imported again, this time leaving it set to 'default'. Now it works.

Doug Gough