I got an runtime error when a node's edit form is trying to save:

Notice: Undefined index: node in node_form_submit_build_node() (line 467 of /var/www/drupal-7.20/modules/node/node.pages.inc).

Here is the line that's the error is referring to:

$node = $form_state['node'];

Apparently $form_state['node'] does not exist!

I was able to get rid of the runtime by hacking the code:

  if ( isset ( $form_state['node'] ) )
    $node = $form_state['node'];
  else if ( isset ( $form_state['complete form']['#node'] ) )
    $node = $form_state['complete form']['#node'];

Comments

lex0r’s picture

Version: 7.20 » 7.33

One of the sites I work on has the same issue, but it happens periodically, either on node add or node edit forms. It may happen like 5 times in a row (for 2-3 content types that are added/updated most often by site editors), and then never happen in the same scenario till next day. I don't see any pattern in it, it's a very hard to find and debug issue. Stack trace gives nothing that might help.

Anyway, I think it can be explained by some environment specifics, probably higher load, or some background processes that may influence core's state.

dcam’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

My guess is that the original report was caused by a contributed module manipulating the $form_state array badly.

As for @lex0r's issue, I could only make a wild guess at what the problem is. It could be caused by a contributed module or by something in the environment like you suggest. A list of the modules you have enabled might help, as well as the details on your server stack. What fields have been added to these node types? Do they have anything in common? Is there any difference between them and the unaffected node types?

Version: 7.33 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.