When the cache module calls `restore_headers` it will sometimes throw an error:
Notice: Undefined index: data in views_plugin_cache->restore_headers() (regel 240 van /home/..../sites/all/modules/contrib/views/plugins/views_plugin_cache.inc).

This is caused due to an assumption that $args['data'] is set.

Files: 
CommentFileSizeAuthor
#5 views-undefined_index_data-2083151-5.patch864 bytesErik Frèrejean
PASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es).
[ View ]
#4 views-undefined_index_data-2083151-4.patch863 bytesErik Frèrejean
FAILED: [[SimpleTest]]: [MySQL] 1,626 pass(es), 1 fail(s), and 0 exception(s).
[ View ]
#1 views-undefined_index_data-2083151-1.patch602 bytesErik Frèrejean
PASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es).
[ View ]

Comments

Erik Frèrejean’s picture

StatusFileSize
new602 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es).
[ View ]

I've attached a patch that will check whether $args['data'] is actually set before calling drupal_add_js().

Erik Frèrejean’s picture

Status:Active» Needs review
CSoft’s picture

Status:Needs review» Needs work

What about css? I have two such errors instead of one.

Necessary to supplement the patch:

if (!empty($this->storage['css'])) {
  foreach ($this->storage['css'] as $args) {
    if (!empty($args['data'])) {
      drupal_add_css($args['data'], $args);
    }
  }
}
Erik Frèrejean’s picture

Status:Needs work» Needs review
StatusFileSize
new863 bytes
FAILED: [[SimpleTest]]: [MySQL] 1,626 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Yes, you are correct. Updated the patch.

Erik Frèrejean’s picture

StatusFileSize
new864 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es).
[ View ]

Looks like I clicked submit to quick, that patch contains a typo in the check.

edvanleeuwen’s picture

Tested it, after having applied https://drupal.org/node/1511396#comment-7911787
No more errors from the plugin.

gapple’s picture

Issue summary:View changes
Status:Needs review» Closed (duplicate)

I think this issue has a better patch, but #2018737: Notice: Undefined index: data in views_plugin_cache->restore_headers() was reported first so marking this as a duplicate.

Exploratus’s picture

Worked for me.