I migrated a page from my development system to the live site, and therefore cleared the cache pages.

A bug in locale.module stops the page from working.

If the cache was cleared, there is no data in there, the there will be no $cache->data to unserialize.
If using http://drupal.org/project/backup_migrate, the cache tables are excluded from the db export by default, so the error occurs here, too.

Bug location: Line 185

      if (!$cache) {
        locale_refresh_cache();
        $cache = cache_get("locale:$locale", 'cache');
      }
      	$locale_t = unserialize($cache->data); // The bug occurs here
...

should read:

      if (!$cache) {
        locale_refresh_cache();
        $cache = cache_get("locale:$locale", 'cache');
      }
      if($cache){
      	$locale_t = unserialize($cache->data);
      }

I created a simple patch.

Comments

drumm’s picture

Status: Needs review » Closed (works as designed)

I was unable to reproduce this behavior by doing 'DELETE FROM cache;' and loading pages while both logged in and not logged in. The 4 lines above this code should handle refreshing the cache before it is unserialized.

suit4’s picture

Apperently, the four lines to refresh the cache did not generata any content in $cache->data, which led to the error on my installation.
It was about manually clearing the cache from DB, so if this is not reproduceable, it might be just on my system.

I just tried, and today, I wasn't even able to reproduce it myself.

Maybe we just keep in mind, that there *might* be a problem here.

Sorry to bother you.