Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.497
diff -u -p -r1.497 theme.inc
--- includes/theme.inc	2 Jul 2009 04:27:22 -0000	1.497
+++ includes/theme.inc	6 Jul 2009 10:42:29 -0000
@@ -1713,7 +1713,7 @@ function theme_more_link($url, $title) {
  */
 function theme_closure($main = 0) {
   $footer = module_invoke_all('footer', $main);
-  return implode("\n", $footer) . drupal_get_js('footer');
+  return drupal_render($footer) . drupal_get_js('footer');
 }
 
 /**
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.47
diff -u -p -r1.47 system.api.php
--- modules/system/system.api.php	5 Jul 2009 18:00:10 -0000	1.47
+++ modules/system/system.api.php	6 Jul 2009 10:42:30 -0000
@@ -148,9 +148,9 @@ function hook_exit($destination = NULL) 
 }
 
 /**
- * Insert closing HTML.
+ * Insert closing elements.
  *
- * This hook enables modules to insert HTML just before the \</body\> closing
+ * This hook enables modules to insert elements just before the \</body\> closing
  * tag of web pages. This is useful for adding JavaScript code to the footer
  * and for outputting debug information. It is not possible to add JavaScript
  * to the header at this point, and developers wishing to do so should use
@@ -159,11 +159,16 @@ function hook_exit($destination = NULL) 
  * @param $main
  *   Whether the current page is the front page of the site.
  * @return
- *   The HTML to be inserted.
+ *   A renderable array to be inserted, keyed by the hook_footer implementation.
  */
 function hook_footer($main = 0) {
   if (variable_get('dev_query', 0)) {
-    return '<div style="clear:both;">' . devel_query_table() . '</div>';
+    return array(
+      'devel' => array(
+        '#type' => 'markup',
+        '#value' => '<div style="clear:both;">' . devel_query_table() . '</div>',
+      ),
+    );
   }
 }
 
Index: modules/toolbar/toolbar.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.module,v
retrieving revision 1.2
diff -u -p -r1.2 toolbar.module
--- modules/toolbar/toolbar.module	5 Jul 2009 18:00:11 -0000	1.2
+++ modules/toolbar/toolbar.module	6 Jul 2009 10:42:30 -0000
@@ -31,13 +31,13 @@ function toolbar_theme($existing, $type,
 }
 
 /**
- * Implementation of hook_page_alter().
+ * Implementation of hook_footer().
  * 
- * Add admin toolbar to the page_top region automatically.
+ * Add admin toolbar to the page automatically.
  */
-function toolbar_page_alter(&$page) {
+function toolbar_footer(&$page) {
   if (user_access('access toolbar')) {
-    $page['page_top']['toolbar'] = toolbar_build();
+    return array('toolbar' => toolbar_build());
   }
 }
 
