We encountered this bug using og_spaces
How to reproduce:
Create an og space -> use page caching, use page compression, set the group offline
When a group is set offline, resulting in a 403 the drupal_page_is_cacheable() function results in true (because $allow_caching_static is true) the second time it enters. This causes spaces to execute drupal_serve_page_from_cache($cache) once again. This causes the output to be gzipped two times resulting in weird browser output.
The search was difficult but the solution is very simple:
In spaces.module change:
function spaces_frontpage() {
$space = spaces_get_space();
if ($space) {
$types = spaces_types();
$type_info = $types[$space->type];
if (isset($type_info['path'])) {
$path = preg_replace('/%(|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$/', $space->id, $type_info['path']);
menu_set_active_item($path);
return menu_execute_active_handler();
}
}
drupal_not_found();
exit;
}
Into:
function spaces_frontpage() {
$space = spaces_get_space();
if ($space) {
$types = spaces_types();
$type_info = $types[$space->type];
if (isset($type_info['path'])) {
$path = preg_replace('/%(|[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$/', $space->id, $type_info['path']);
menu_set_active_item($path);
menu_execute_active_handler();
exit();
}
}
drupal_not_found();
exit;
}
This makes sure drupal_deliver_page() isnt called two times resulting in a double gzipped output.
Comments
Comment #1
domidc commentedthe patch file
Comment #2
djdevinThe definition of menu_execute_active_handler() changed in Drupal 7 - so this works too, only slightly cleaner.
The second parameter indicates if the page should be sent immediately or returned to the caller.
https://api.drupal.org/api/drupal/includes%21menu.inc/function/menu_exec...
Comment #3
djdevin