If I enable a Simple Cache on a pane, and clear the cache, I get the following errors:

  • Notice: Undefined index: use_pager in panels_simple_cache_get_id() (line 107 of /var/www/html/d6/drupal-6.22/sites/all/modules/panels/plugins/cache/simple.inc).
  • Notice: Undefined variable: tokens in panels_cache_object->cache() (line 214 of /var/www/html/d6/drupal-6.22/sites/all/modules/panels/includes/plugins.inc).
  • Notice: Undefined index: use_pager in panels_simple_cache_get_id() (line 107 of /var/www/html/d6/drupal-6.22/sites/all/modules/panels/plugins/cache/simple.inc).

On the next refresh, I do not get the pane and only one error:

  • Notice: Undefined index: use_pager in panels_simple_cache_get_id() (line 107 of /var/www/html/d6/drupal-6.22/sites/all/modules/panels/plugins/cache/simple.inc).

Comments

nicholasThompson’s picture

The use_pager bug can be fixed using:


diff --git a/plugins/cache/simple.inc b/plugins/cache/simple.inc
index 916df42..980d834 100644
--- a/plugins/cache/simple.inc
+++ b/plugins/cache/simple.inc
@@ -104,7 +104,7 @@ function panels_simple_cache_get_id($conf, $display, $args, $contexts, $pane) {
     $id .= ':' . $language->language;
   }

-  if($pane->configuration['use_pager'] == 1) {
+  if(isset($pane->configuraton['use_pager']) && ($pane->configuration['use_pager'] == 1)) {
     $id .= ':p' . check_plain($_GET['page']);
   }

As for the token issue, I simply removed the following from includes/plugin.inc and (a) the error went away and (b) My pane reappeared.

    // And for tokens:
    $tokens = ctools_set_page_token();
    foreach ($this->tokens as $token => $argument) {
      if (isset($tokens[$token])) {
        unset($tokens);
      }
    }

    $this->tokens = $tokens;

I'm not entirely sure what this code is trying to achieve. Should it be merging rather than un-setting?

EDIT: To clarify - this is on line 208 of includes/plugin.inc (at the end of function cache()).

nicholasThompson’s picture

Hmm actually the issue appears to be more related to if you cache an entire panel AND a pane...

In my case I have a panel and I add the Page Title pane. I then enable a Simple Cache on both the pane and the panel. On the first load, the Page Title pane appears correctly, but on the following load I get the text "Array" instead. However, if I only enable the Simple Cache on the PANE (not the whole PANEL), then there is no error..

nicholasThompson’s picture

I have found that changing the above token snippet simply to:

 $this->tokens += ctools_set_page_token();

That merges any page-specific tokens into the array to be cached... Although it is a bit of a "brute force" approach.

Letharion’s picture

Title: Panels Simple Cache errors... » Panels Simple Cache undefined index notices.
Status: Active » Postponed (maintainer needs more info)

Hello nicholasThompson, can you please provide
1) A way to reproduce this, and
2) your fix in a patch format, to allow for a review.

Letharion’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
brunodbo’s picture

Version: 6.x-3.x-dev » 7.x-3.9
Issue summary: View changes
Status: Closed (cannot reproduce) » Active

This is still happening in 7.x-3.9:

- Add the 'Page title' pane to a panel page (in my case, the node_view panel)
- Enable 'Simple cache' on the display
- On the first page load (not cached), the page title pane will appear normally (outputting the page title with tags if configured).
- On subsequent page loads (cached), the page title pane will output Array instead of the page title.

The solution mentioned in #3 didn't work for me.

joelpittet’s picture

Version: 7.x-3.9 » 7.x-3.x-dev
Priority: Normal » Major
Parent issue: » #2850154: Plan for Panels 7.x-3.10
joelpittet’s picture

Version: 7.x-3.x-dev » 7.x-3.9
Priority: Major » Normal
Status: Active » Closed (duplicate)
Parent issue: #2850154: Plan for Panels 7.x-3.10 »

Worked with @brunodbo this afternoon and turns out this is a ctools bug. Closing as a duplicate of #1365522: Caching issue: include files not included when processing page tokens?