If another preprocessor or processor has already rendered the $page variable AdvAgg will clobber $page_top, $page_bottom and $page resulting in an empty page.

The problematic code is:

  if (isset($variables['page']['page_top'])) {
    $variables['page_top'] = drupal_render($variables['page']['page_top']);
  }
  elseif (!isset($variables['page_top'])) {
    $variables['page_top'] = '';
  }
  if (isset($variables['page']['page_bottom'])) {
    $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
  }
  elseif (!isset($variables['page_bottom'])) {
    $variables['page_bottom'] = '';
  }
  // Place the rendered HTML for the page body into a top level variable.
  if (isset($variables['page']['#children'])) {
    $variables['page'] = $variables['page']['#children'];
  }

The problem is if $variables['page'] is a string 'page_top' gets cast to the integer 1, isset() returns true and we end up calling drupal_render() on the second character of the string and set $variables['page_top'] to the return value.

We should probably check that $variables['page'] is indeed an array in these if statements to fix the problem. I'll attach a patch in the comments.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dean Reilly created an issue. See original summary.

Dean Reilly’s picture

Status: Active » Needs review
FileSize
1.1 KB
DamienMcKenna’s picture

Status: Needs review » Reviewed & tested by the community

Looks entirely reasonable.

mikeytown2’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch! Also thanks for testing out the patch! It's been committed.

Status: Fixed » Closed (fixed)

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