There is a bug in _blockcache_alter_get_cache_id.

The problem is this line:
$block->cache = db_result(db_query("SELECT cache FROM {blocks} WHERE module = '%s' AND delta = %d AND theme = '%s'", $module, $delta, $theme));

This uses the %d placeholder for the $delta value. If $delta is a string, it is converted to an integer. In most cases, this ends up being 1. This can cause the query to return a very large result set. db_result() will return one value and it is most likely incorrect. In my case, this was causing blocks to be cached globally when they should have been cached per role per page. I've attached a patch that fixes the problem.

CommentFileSizeAuthor
blockcache_alter.patch884 bytesjtsnow

Comments

swentel’s picture

Status: Active » Fixed

Nice catch, committed to D6 branch, thanks for the report!
http://drupal.org/cvs?commit=336728

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ccshannon’s picture

Normally I would not post in a closed issue, but in case anyone has the problems I was having with Context, Views and Blocks:

1. I downloaded this module today (August 31, 2011) and the problem is still there in the release version. I also notice that comment #8 here #1062796: Integration with Block Cache Alter refers to another issue which is changed in dev but not in release. Just pointing it out. Dev version might be better for production than release version.

2. This bug prevents most Views Blocks from being cached and retrieved using Block Cache Alter and Context Block Cache Alter, because Views tends to store a string in the delta field.