Closed (fixed)
Project:
Advanced cache
Version:
5.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
30 May 2007 at 13:41 UTC
Updated:
14 Jun 2007 at 16:18 UTC
Mmm, there is something I don't understand with node_cache.patch.
We set the cached node only if current user is an 'authenticated user', but we get this cached node unconditionnaly. So it means that everybody on the site get 'authenticated user' nodes, right ?
Does the following code change makes more sense ? We get the cached node only if current user is an 'authenticated user' too.
if ($cachable) {
if (isset($nodes[$param])) {
return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param];
}
if ($user->uid > 1 && count($user->roles) === 1 && in_array('authenticated user', $user->roles)) {
$cache = cache_get($param, 'cache_node');
if ($cache) {
$cache = unserialize($cache->data);
$nodes[$param] = is_object($cache) ? drupal_clone($cache) : $cache;
return $nodes[$param];
}
}
Comments
Comment #1
robertdouglass commentedGood catch. I think this is a valid bug and have a hunch that similar code to the proposed was in an ancient version of the patch, and then got overlooked.
Comment #2
robertdouglass commentedFixed by applying the new base-2 integer cache key scheme to cache lookups as well as cache sets.
Comment #3
(not verified) commented