From 6afea0a06499dc17fa1a4c9f4d4e210c477ba877 Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Mon, 2 Nov 2009 23:20:28 +0000
Subject: [PATCH] #564642 by Scott Reynolds, Damien Tournoud, matt2000, and
 moshe weitzman: Remove previous content property from build functions so
 artifacts do not persist.

---
 modules/comment/comment.module | 5 ++---
 modules/node/node.module       | 6 +++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 119b494ea5ca..762c71749122 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -839,9 +839,8 @@ function comment_build($comment, stdClass $node, $build_mode = 'full') {
  *   Build mode, e.g. 'full', 'teaser'...
  */
 function comment_build_content($comment, stdClass $node, $build_mode = 'full') {
-  if (empty($comment->content)) {
-    $comment->content = array();
-  }
+  // Remove previously built content, if exists.
+  $comment->content = array();
 
   // Build comment body.
   $comment->content['comment_body'] = array(
diff --git a/modules/node/node.module b/modules/node/node.module
index 6a25cfc05a76..84cc776ffb6b 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1180,6 +1180,9 @@ function node_build($node, $build_mode = 'full') {
  *
  */
 function node_build_content(stdClass $node, $build_mode = 'full') {
+  // Remove previously built content, if exists.
+  $node->content = array();
+
   // The 'view' hook can be implemented to overwrite the default function
   // to display nodes.
   if (node_hook($node, 'view')) {
@@ -1187,9 +1190,6 @@ function node_build_content(stdClass $node, $build_mode = 'full') {
   }
 
   // Build fields content.
-  if (empty($node->content)) {
-    $node->content = array();
-  };
   $node->content += field_attach_view('node', $node, $build_mode);
 
   // Always display a read more link on teasers because we have no way
-- 
GitLab