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.

CommentFileSizeAuthor
#1 spaces-gzip.patch831 bytesdomidc

Comments

domidc’s picture

StatusFileSize
new831 bytes

the patch file

djdevin’s picture

The definition of menu_execute_active_handler() changed in Drupal 7 - so this works too, only slightly cleaner.

-      return menu_execute_active_handler();
+      return menu_execute_active_handler(NULL, FALSE);

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...

djdevin’s picture

Status: Active » Reviewed & tested by the community