The first data argument to drupal_execute() is being removed before drupal_retrieve_form() is called. The array_slice() in drupal_execute() is dropping the first 3 arguments instead of the first 2.

Some of the affected forms are node_form and taxonomy_form_term

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yched’s picture

I'm not exactly sure what this patch fixes, but it does not remove the PHP warnings reported in http://drupal.org/node/144025
(which I maybe hastily marked as duplicate of this one) - we should probably tackle all the drupal_execute errors in one go...

notice: Undefined index: submitted in includes\form.inc on line 865.
notice: Undefined index: form_build_id in includes\form.inc on line 283.
notice: Undefined index: form_build_id in includes\form.inc on line 284.

asimmonds’s picture

Priority: Critical » Normal

A little more of a explanation, taking the drupal_execute() node creation example from form.inc:

// Create a new node
$form_state = array();
$node = array('type' => 'story');
$form_state['values']['title'] = 'My node';
$form_state['values']['body'] = 'This is the body text!';
$form_state['values']['name'] = 'robo-user';
drupal_execute('story_node_form', $form_state, $node);

Before this patch, with the argument rearranging in drupal_retrieve_form(), the $node argument will not be passed through to the node_form function.

asimmonds’s picture

Attached is a patch that I use to run drupal_execute on current HEAD without any warnings generated.
The $args juggling in drupal_execute() is not required anymore.

Dries’s picture

Status: Needs review » Fixed

Works for me! Committed. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)