Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1136
diff -u -9 -p -r1.1136 node.module
--- modules/node/node.module	3 Oct 2009 00:52:24 -0000	1.1136
+++ modules/node/node.module	3 Oct 2009 17:01:16 -0000
@@ -616,19 +616,19 @@ function node_type_update_nodes($old_typ
  * The list of types is built by querying hook_node_info() in all modules, and
  * by comparing this information with the node types in the {node_type} table.
  *
  */
 function _node_types_build() {
   $_node_types = &drupal_static(__FUNCTION__);
   if (is_object($_node_types)) {
     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) {
     $info['type'] = $type;
     $_node_types->types[$type] = node_type_set_defaults($info);
     $_node_types->names[$type] = $info['name'];
   }
   $type_result = db_select('node_type', 'nt')
     ->fields('nt')
@@ -707,34 +707,34 @@ function node_type_set_defaults($info = 
   $new_type->orig_type = isset($info['type']) ? $info['type'] : '';
 
   return $new_type;
 }
 
 /**
  * Determine whether a node hook exists.
  *
  * @param $node
- *   Either a node object, node array, or a string containing the node type.
+ *   A node object or a string containing the node type.
  * @param $hook
  *   A string containing the name of the hook.
  * @return
  *   TRUE if the $hook exists in the node type of $node.
  */
 function node_hook($node, $hook) {
   $base = node_type_get_base($node);
   return module_hook($base, $hook);
 }
 
 /**
  * Invoke a node hook.
  *
  * @param $node
- *   Either a node object, node array, or a string containing the node type.
+ *   A node object or a string containing the node type.
  * @param $hook
  *   A string containing the name of the hook.
  * @param $a2, $a3, $a4
  *   Arguments to pass on to the hook, after the $node argument.
  * @return
  *   The returned value of the invoked hook.
  */
 function node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
   if (node_hook($node, $hook)) {
@@ -785,20 +785,18 @@ function node_load($nid = NULL, $vid = N
   $conditions = (isset($vid) ? array('vid' => $vid) : array());
   $node = node_load_multiple($nids, $conditions, $reset);
   return $node ? reset($node) : FALSE;
 }
 
 /**
  * Perform validation checks on the given node.
  */
 function node_validate($node, $form = array()) {
-  // Convert the node to an object, if necessary.
-  $node = (object)$node;
   $type = node_type_get_type($node);
 
   if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) {
     form_set_error('changed', t('The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.'));
   }
 
   if (user_access('administer nodes')) {
     // Validate the "authored by" field.
     if (!empty($node->name) && !($account = user_load_by_name($node->name))) {
@@ -819,21 +817,18 @@ function node_validate($node, $form = ar
   module_invoke_all('node_validate', $node, $form);
 }
 
 /**
  * Prepare node for save and allow modules to make changes.
  */
 function node_submit($node) {
   global $user;
 
-  // Convert the node to an object, if necessary.
-  $node = (object)$node;
-
   if (user_access('administer nodes')) {
     // Populate the "authored by" field.
     if ($account = user_load_by_name($node->name)) {
       $node->uid = $account->uid;
     }
     else {
       $node->uid = 0;
     }
   }
@@ -1034,28 +1029,26 @@ function node_revision_delete($revision_
     return TRUE;
   }
   return FALSE;
 }
 
 /**
  * Generate an array for rendering the given node.
  *
  * @param $node
- *   A node array or node object.
+ *   A node object.
  * @param $build_mode
  *   Build mode, e.g. 'full', 'teaser'...
  *
  * @return
  *   An array as expected by drupal_render().
  */
 function node_build($node, $build_mode = 'full') {
-  $node = (object)$node;
-
   // Populate $node->content with a render() array.
   node_build_content($node, $build_mode);
 
   $build = $node->content;
   // We don't need duplicate rendering info in node->content.
   unset($node->content);
   
   $build += array(
     '#theme' => 'node',
@@ -2209,38 +2202,34 @@ function node_search_validate($form, &$f
  * specified node.
  *
  * @param $op
  *   The operation to be performed on the node. Possible values are:
  *   - "view"
  *   - "update"
  *   - "delete"
  *   - "create"
  * @param $node
- *   The node object (or node array) on which the operation is to be performed,
- *   or node type (e.g. 'forum') for "create" operation.
+ *   The node object on which the operation is to be performed, or node type
+ *   (e.g. 'forum') for "create" operation.
  * @param $account
  *   Optional, a user object representing the user for whom the operation is to
  *   be performed. Determines access for a user other than the current user.
  * @return
  *   TRUE if the operation may be performed, FALSE otherwise.
  */
 function node_access($op, $node, $account = NULL) {
   global $user;
 
   if (!$node || !in_array($op, array('view', 'update', 'delete', 'create'), TRUE)) {
     // If there was no node to check against, or the $op was not one of the
     // supported ones, we return access denied.
     return FALSE;
   }
-  // Convert the node to an object if necessary:
-  if ($op != 'create') {
-    $node = (object)$node;
-  }
   // If no user object is supplied, the access check is for the current user.
   if (empty($account)) {
     $account = $user;
   }
 
   if (user_access('bypass node access', $account)) {
     return TRUE;
   }
 
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.83
diff -u -9 -p -r1.83 node.pages.inc
--- modules/node/node.pages.inc	29 Sep 2009 15:31:15 -0000	1.83
+++ modules/node/node.pages.inc	3 Oct 2009 17:01:16 -0000
@@ -55,34 +55,33 @@ function theme_node_add_list($content) {
  */
 function node_add($type) {
   global $user;
 
   $types = node_type_get_types();
   $type = isset($type) ? str_replace('-', '_', $type) : NULL;
   // If a node type has been specified, validate its existence.
   if (isset($types[$type]) && node_access('create', $type)) {
     // Initialize settings:
-    $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');
+    $node = (object)array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');
 
     drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH);
     $output = drupal_get_form($type . '_node_form', $node);
   }
 
   return $output;
 }
 
 function node_form_validate($form, &$form_state) {
-  $node = $form_state['values'];
+  $node = (object)$form_state['values'];
   node_validate($node, $form);
 
   // Field validation. Requires access to $form_state, so this cannot be
   // done in node_validate() as it currently exists.
-  $node = (object)$node;
   field_attach_form_validate('node', $node, $form, $form_state);
 }
 
 function node_object_prepare($node) {
   // Set up default values, if required.
   $node_options = variable_get('node_options_' . $node->type, array('status', 'promote'));
   // If this is a new node, fill in the default values.
   if (!isset($node->nid)) {
     foreach (array('status', 'promote', 'sticky') as $key) {
@@ -105,24 +104,23 @@ function node_object_prepare($node) {
 }
 
 /**
  * Generate the node add/edit form array.
  */
 function node_form($form, &$form_state, $node) {
   global $user;
 
   if (isset($form_state['node'])) {
-    $node = $form_state['node'] + (array)$node;
+    $node = (object)($form_state['node'] + (array)$node);
   }
   if (isset($form_state['node_preview'])) {
     $form['#prefix'] = $form_state['node_preview'];
   }
-  $node = (object)$node;
   foreach (array('title') as $key) {
     if (!isset($node->$key)) {
       $node->$key = NULL;
     }
   }
   if (!isset($form_state['node_preview'])) {
     node_object_prepare($node);
   }
   else {
@@ -435,19 +433,19 @@ function node_form_submit($form, &$form_
 
 /**
  * Build a node by processing submitted form values and prepare for a form rebuild.
  */
 function node_form_submit_build_node($form, &$form_state) {
   // Unset any button-level handlers, execute all the form-level submit
   // functions to process the form values into an updated node.
   unset($form_state['submit_handlers']);
   form_execute_handlers('submit', $form, $form_state);
-  $node = node_submit($form_state['values']);
+  $node = node_submit((object)$form_state['values']);
 
   field_attach_submit('node', $node, $form, $form_state);
 
   $form_state['node'] = (array)$node;
   $form_state['rebuild'] = TRUE;
   return $node;
 }
 
 /**
