Closed (works as designed)
Project:
Drupal core
Version:
5.7
Component:
locale.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 May 2008 at 10:20 UTC
Updated:
13 Jun 2008 at 08:46 UTC
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.
| Comment | File | Size | Author |
|---|---|---|---|
| locale_dont_unserialize_nonexisting_cache.patch | 431 bytes | suit4 |
Comments
Comment #1
drummI 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.
Comment #2
suit4 commentedApperently, 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.