title: Drupal 7 : change nid after node load
body: <p>I have a very strange case in new developpement of an site web. I had made a block (with a custom module) and I make a node_load. Here all is ok, the node is load, the block is display. But for if I change nid of node (by exemple set null) and do nothing else (no node_save, no function call, NOTHING with this object), I have some notice of different module (like 3 or 4 modules). I know it's just notice, but I would understand why the simply fact of change variables wich is never uses, trigger some error..... Exemple :</p>
  
  <pre><code>$tmp = node_load(arg(1));
  $tmp-&gt;nid=null;
  </code></pre>
  
  <p>=> error (lot of "Trying to get property of non-object in..." in diffrent name function)</p>
  
  <pre><code>$tmp = node_load(arg(1));
  $node=$tmp;
  $node-&gt;nid=null;
  </code></pre>
  
  <p>=> error (lot of "Trying to get property of non-object in..." in diffrent name function)</p>
  
  <pre><code>$tmp = node_load(arg(1));
  $node = new stdClass();
  //Copy via une boucle sinon on a des erreurs.
  foreach ($tmp as $key =&gt; $value) {
    if ($key != 'nid') $node-&gt;{$key} = $value;
  }
  </code></pre>
  
  <p>=> all is ok </p>