Views' node_preprocess hook can be passed node objects with a views object attached without the views theme system initialized. If this view uses a node_view row plugin, then function node_row_node_view_preprocess_node will be called without the required file being included.

Steps to reproduce:

  1. Create a block view with rendered node display, e.g. teaser
  2. Make this view select a particular node, e.g. node 1
  3. Set this view to be cached
  4. Place this block on a page
  5. Add another block, or panel or whatever with this same node rendered on the page, using any view mode, with no cache settings, loading after the cached view
  6. The node object passed to node_view will contain the views object and throw a fatal error in views_preprocess_node

I added a few lines to conditionally load this file if function does not exist, as you can see in the attached patch, but I am sure there is a more reasonable way to do this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wesnick’s picture

Version: 7.x-3.7 » 7.x-3.x-dev
Issue summary: View changes
Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, view-cached-node-conditional-include.patch, failed testing.

Y.sa’s picture

FileSize
590 bytes

Same probleme here, the patch is working.
Here is another try to pass the robot.

Y.sa’s picture

Status: Needs work » Needs review
Chris Matthews’s picture

The 4 year old patch in #3 to views.module applied cleanly to the latest views 7.x-3.x-dev and if still relevant needs to be reviewed.