The reason i ask, is current all the form functions are expecting the $edit var to be passed by reference, yet drupal_get_form uses func_get_args which seems to only ever pass things except objects by value.

I did some basic debug (print_r stuff) and they seem to confirm my assumptions that only the validation functions (called by hand, not by drupal_get_form) are able to pass by reference. Upshot of this, is $edit['errors'] is never set in the calling function and so never saved to the session.

Anyone please confirm/deny.

a_c_m

Comments

Robrecht Jacques’s picture

It is possible that it only worked in 4.7.x and 4.6.x, and never in 5.x.

On the other hand. Everything that is $edit should be in $_SESSION. The form handling is not "normal" for Drupal 5.x - the only way in 4.7.x to write a multipage wizard was to store things yourself in $_SESSION. Drupal 5.x changed that (making it feasable to write a drupal_get_form() wizard form), but node_import never converted and basically still uses Drupal 4.7.x like forms.

See function node_import_page() how $edit is read and written to $_SESSION.

Now, it _is_ possible that for some reason this does not work for downloading the errors.

a_c_m’s picture

The problem is in that function node_import_page(), the $edit variable is passed by reference to the forms via drupal_get_form, but it gets caught up in the process and ends up getting passed by value - so the changes made inside the forms (ie setting the errors) never make it out of the function to be written into the session. A work around could be to write it into the session @ the end of each form function before returning the output.

Robrecht Jacques’s picture

Status: Active » Closed (won't fix)

5.x is no longer supported. If you have the same issue with the 6.x branch please reopen.