From b075615bda49b7c10e18f702a1d8e9753590b393 Mon Sep 17 00:00:00 2001
From: David Meister <thedavidmeister@gmail.com>
Date: Sun, 9 Jun 2013 18:20:05 +1000
Subject: [PATCH] 2012812-18

---
 core/includes/common.inc | 4 ++--
 core/includes/theme.inc  | 5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/includes/common.inc b/core/includes/common.inc
index 00decfa..86646c7 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4800,7 +4800,7 @@ function drupal_render(&$elements) {
   // Initialize this element's #children, unless a #pre_render callback already
   // preset #children.
   if (!isset($elements['#children'])) {
-    $elements['#children'] = '';
+    $elements['#children'] = NULL;
   }
   // Call the element's #theme function if it is set. Then any children of the
   // element have to be rendered there. If the internal #render_children
@@ -4812,7 +4812,7 @@ function drupal_render(&$elements) {
   // If #theme was not set and the element has children, render them now.
   // This is the same process as drupal_render_children() but is inlined
   // for speed.
-  if ($elements['#children'] === '') {
+  if (!isset($elements['#children'])) {
     foreach ($children as $key) {
       $elements['#children'] .= drupal_render($elements[$key]);
     }
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index a3f967a..35269f0 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -978,7 +978,10 @@ function theme($hook, $variables = array()) {
       if (!isset($candidate)) {
         watchdog('theme', 'Theme hook %hook not found.', array('%hook' => $hook), WATCHDOG_WARNING);
       }
-      return '';
+      // There is no theme implementation for the hook passed. Return NULL so
+      // the function calling theme() can differentiate between a hook that
+      // exists and renders an empty string and a hook that is not implemented.
+      return NULL;
     }
   }
 
-- 
1.7.11.1

