title: Drupal node_save is not saving fields
body: <p>I have just stumbled upon very strange behaviour. In my code I am saving new node with some fields. I must say this used to work perfectly well. However now it just stopped working. I use the devel module to print out the content of objects and variables and this is my code:</p>
  
  <p>
  
  <pre><code>dsm($node);
  node_save($node);
  dsm($node);
  </code></pre>
  
  <p>The first dsm() function displays node object as I created it and as it is supposed to be. The second dsm() function displays entirely correct node object with nid populated, fields content, etc... However, none of the fields is saved in database although there is new record in {node} table. Also, node_save does not generate any kind of error.</p>
  
  <p>Any idea what is happening here?</p>
  
  <p>This is the function storing the node:</p>
  
  <pre><code>function manhattan_incident_save($data) {
  if ($data['nid']) {
    $node = node_load($data['nid']);
    manhattan_compare_changes($node, $data);
  }
  else {
    $node = new stdClass();
    $node-&gt;type = 'incident';
    node_object_prepare($node);
  
    $node-&gt;title = manhattan_create_incident_id();
    $node-&gt;language = LANGUAGE_NONE;      
  }
  
  $node-&gt;field_incident_popis[$node-&gt;language][0]['value'] = $data['field_incident_popis'];
  $node-&gt;field_incident_popis[$node-&gt;language][0]['safe_value'] = check_plain($data['field_incident_popis']);
  
  $node-&gt;field_incident_agent[$node-&gt;language][0]['uid'] = isset($data['field_incident_agent'])?intval($data['field_incident_agent']):NULL;
  
  $node-&gt;field_incident_zdroj[$node-&gt;language][0]['tid'] = intval($data['field_incident_zdroj']);
  $node-&gt;og_group_ref[$node-&gt;language][0]['target_id'] = $data['field_incident_oblast']?intval($data['field_incident_oblast']):variable_get('manhattan_public_form_default_area_nid', NULL);
  $node-&gt;field_incident_riesitel[$node-&gt;language][0]['uid'] = isset($data['field_incident_riesitel'])?intval($data['field_incident_riesitel']):NULL;
  $node-&gt;field_incident_typ[$node-&gt;language][0]['tid'] = intval($data['field_incident_typ']);
  $node-&gt;field_incident_doplnenie[$node-&gt;language][0]['nid'] = intval($data['field_incident_doplnenie']);
  $node-&gt;field_incident_sposob_kontaktu[$node-&gt;language][0]['value'] = $data['field_incident_sposob_kontaktu'];
  $node-&gt;field_incident_dovod_vzniku[$node-&gt;language][0]['tid'] = intval($data['field_incident_dovod_vzniku']);
  
  if ($data['field_incident_suvisiaci_zaznam']) {
    foreach ($data['field_incident_suvisiaci_zaznam'] as $file) {
      $result = manhattan_save_files($file);
      if ($result) {
        $node-&gt;field_incident_suvisiaci_zaznam[$node-&gt;language][] = array('nid' =&gt; $result); 
      }
    }
  }
  
  // now create/save the customer
  if (function_exists('customer_customer_save')) {
    $customer = $data;
    $customer['nid'] = $data['field_incident_customer'];
    $result = customer_customer_save($customer); 
    if ($result) {
      watchdog('upvs', $result['message'], array(), WATCHDOG_NOTICE);
    }
    else {
      watchdog('upvs', t('There was a problem with saving customer %nid'), array('%nid' =&gt; $data['nid']), WATCHDOG_ERROR);
    }
  }
  // now we store nid of saved customer to the node object
  $node-&gt;field_incident_customer[$node-&gt;language][0]['nid'] = $result['nid'];
  
  dsm($node);
  node_save($node); 
  dsm($node);
  
  if ($data['nid']) {
    watchdog('upvs', t('Incident number %title has been succesfully saved.'), array('%title' =&gt; $node-&gt;title), WATCHDOG_NOTICE);
  }
  else {
    watchdog('upvs', t('Incident number %title has been succesfully created.'), array('%title' =&gt; $node-&gt;title), WATCHDOG_NOTICE);
  }
  
  return $node;
  }
  </code></pre>