From d366e3806d3940904d7edc381932c7ba01fa22c3 Mon Sep 17 00:00:00 2001
From: Chris Skene <chris@xtfer.com>
Date: Mon, 18 Apr 2016 22:16:11 +1000
Subject: [PATCH] Issue #564642: Fix an issue where recursive node_view calls
 throws a fatal error

---
 modules/node/node.module | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/node/node.module b/modules/node/node.module
index 1d88834..d48a40b 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1332,12 +1332,15 @@ function node_view($node, $view_mode = 'full', $langcode = NULL) {
     $langcode = $GLOBALS['language_content']->language;
   }
 
+  // To support recursive calls, save any existing build information.
+  $existing_content = isset($node->content) ? $node->content : NULL;
+
   // Populate $node->content with a render() array.
   node_build_content($node, $view_mode, $langcode);
 
   $build = $node->content;
-  // We don't need duplicate rendering info in node->content.
-  unset($node->content);
+  // Reset $node->content with any existing build information.
+  $node->content = $existing_content ;
 
   $build += array(
     '#theme' => 'node',
-- 
2.6.4

