Index: modules/node/node.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.install,v
retrieving revision 1.55
diff -u -p -r1.55 node.install
--- modules/node/node.install	13 Sep 2010 05:50:09 -0000	1.55
+++ modules/node/node.install	20 Sep 2010 21:04:25 -0000
@@ -481,7 +481,7 @@ function node_update_7004() {
 
   // Map old preview setting to new values order.
   $original_preview ? $original_preview = 2 : $original_preview = 1;
-  drupal_static_reset('_node_types_build');
+  node_type_cache_reset();
   $type_list = node_type_get_types();
 
   // Apply original settings to all types.
@@ -513,7 +513,7 @@ function node_update_7006(&$sandbox) {
   $sandbox['#finished'] = 0;
 
   // Get node type info for every invocation.
-  drupal_static_reset('_node_types_build');
+  node_type_cache_reset();
   $node_types = node_type_get_types();
 
   if (!isset($sandbox['total'])) {
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1301
diff -u -p -r1.1301 node.module
--- modules/node/node.module	18 Sep 2010 01:39:33 -0000	1.1301
+++ modules/node/node.module	20 Sep 2010 21:03:48 -0000
@@ -462,7 +462,7 @@ function node_type_get_name($node) {
  */
 function node_types_rebuild() {
   // Reset and load updated node types.
-  drupal_static_reset('_node_types_build');
+  node_type_cache_reset();
   foreach (node_type_get_types() as $type => $info) {
     if (!empty($info->is_new)) {
       node_type_save($info);
@@ -540,7 +540,7 @@ function node_type_save($info) {
   }
 
   // Clear the node type cache.
-  drupal_static_reset('_node_types_build');
+  node_type_cache_reset();
 
   return $status;
 }
@@ -631,7 +631,7 @@ function node_type_delete($type) {
   module_invoke_all('node_type_delete', $info);
 
   // Clear the node type cache.
-  drupal_static_reset('_node_types_build');
+  node_type_cache_reset();
 }
 
 /**
@@ -675,10 +675,16 @@ function node_type_update_nodes($old_typ
  */
 function _node_types_build() {
   $_node_types = &drupal_static(__FUNCTION__);
-  if (is_object($_node_types)) {
+  if (isset($_node_types)) {
+    return $_node_types;
+  }
+
+  if ($cache = cache_get('node_types')) {
+    $_node_types = $cache->data;
     return $_node_types;
   }
-  $_node_types = (object)array('types' => array(), 'names' => array());
+
+  $_node_types = (object) array('types' => array(), 'names' => array());
 
   $info_array = module_invoke_all('node_info');
   foreach ($info_array as $type => $info) {
@@ -713,10 +719,20 @@ function _node_types_build() {
 
   asort($_node_types->names);
 
+  cache_set('node_types', $_node_types);
+
   return $_node_types;
 }
 
 /**
+ * Clears the node type cache.
+ */
+function node_type_cache_reset() {
+  cache_clear_all('node_types', 'cache');
+  drupal_static_reset('_node_types_build');
+}
+
+/**
  * Set the default values for a node type.
  *
  * The defaults are for a type defined through hook_node_info().
@@ -727,32 +743,25 @@ function _node_types_build() {
  *   An object or array containing values to override the defaults.
  *
  * @return
- *  A node type object.
+ *   A node type object.
  */
 function node_type_set_defaults($info = array()) {
-  $type = &drupal_static(__FUNCTION__);
-
-  if (!isset($type)) {
-    $type = new stdClass();
-    $type->type = '';
-    $type->name = '';
-    $type->base = '';
-    $type->description = '';
-    $type->help = '';
-    $type->custom = 0;
-    $type->modified = 0;
-    $type->locked = 1;
-    $type->is_new = 1;
-
-    $type->has_title = 1;
-    $type->title_label = 'Title';
-  }
-
-  $new_type = clone $type;
   $info = (array) $info;
-  foreach ($info as $key => $data) {
-    $new_type->$key = $data;
-  }
+  $new_type = $info + array(
+    'type' => '',
+    'name' => '',
+    'base' => '',
+    'description' => '',
+    'help' => '',
+    'custom' => 0,
+    'modified' => 0,
+    'locked' => 1,
+    'is_new' => 1,
+    'has_title' => 1,
+    'title_label' => 'Title',
+  );
+
+  $new_type = (object) $new_type;
   // If the type has no title, set an empty label.
   if (!$new_type->has_title) {
     $new_type->title_label = '';
@@ -1872,7 +1881,7 @@ function node_menu() {
   // @todo Remove this loop when we have a 'description callback' property.
   // Reset internal static cache of _node_types_build(), forces to rebuild the
   // node type information.
-  drupal_static_reset('_node_types_build');
+  node_type_cache_reset();
   foreach (node_type_get_types() as $type) {
     $type_url_str = str_replace('_', '-', $type->type);
     $items['node/add/' . $type_url_str] = array(
Index: modules/node/node.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.test,v
retrieving revision 1.95
diff -u -p -r1.95 node.test
--- modules/node/node.test	17 Sep 2010 14:53:21 -0000	1.95
+++ modules/node/node.test	20 Sep 2010 20:53:47 -0000
@@ -577,6 +577,8 @@ class SummaryLengthTestCase extends Drup
 }
 
 class NodeTitleXSSTestCase extends DrupalWebTestCase {
+  protected $profile = 'testing';
+
   public static function getInfo() {
     return array(
       'name' => 'Node title XSS filtering',
@@ -585,6 +587,16 @@ class NodeTitleXSSTestCase extends Drupa
     );
   }
 
+  function setUp() {
+    parent::setUp();
+
+    $this->drupalCreateContentType(array(
+      'type' => 'page',
+      'name' => t('Basic page'),
+      'base' => 'node_content',
+    ));
+  }
+
   function testNodeTitleXSS() {
     // Prepare a user to do the stuff.
     $web_user = $this->drupalCreateUser(array('create page content', 'edit any page content'));
@@ -592,8 +604,10 @@ class NodeTitleXSSTestCase extends Drupa
 
     $xss = '<script>alert("xss")</script>';
     $title = $xss . $this->randomName();
-    $edit = array("title" => $title);
 
+    $this->drupalGet('node/add');
+
+    $edit = array("title" => $title);
     $this->drupalPost('node/add/page', $edit, t('Preview'));
     $this->assertNoRaw($xss, t('Harmful tags are escaped when previewing a node.'));
 
