When trying to save a node with FileField populated with a file that exceeds the PHP limit, Drupal just returns to node/add without any error messages.

This is bypassing the AJAX upload option and using PHP 5.5.3-1ubuntu2.3 (Ubuntu 13.10) and Drupal 7.26.

Ideally, there should be an error message that tells the user why they are being returned to a blank form.

Not sure if this behavior is limited to Drupal 7.

CommentFileSizeAuthor
#1 FailedFormSubmissionMsg-2239313.patch591 bytespmagunia
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pmagunia’s picture

Title: No Error Messages When Drupal Upload Exceeds PHP Limit » No Error Messages For Failed Form Submissions
Component: file system » forms system
Status: Active » Needs review
FileSize
591 bytes

This behavior seems to be triggered when the function form_builder is not setting the process_input flag in form.inc:

if ($form_state['programmed'] || (!empty($form_state['input']) && (isset($form_state['input']['form_id']) && ($form_state['input']['form_id'] == $form_id)))) {
      $form_state['process_input'] = TRUE;
    }
    else {
      $form_state['process_input'] = FALSE;
    }

Hence, none of the validation code in drupal_process_form is executed. There is a comment in form.inc regarding this:


drupal_process_form($form_id, $form, $form_state);

// If this was a successful submission of a single-step form or the last step
// of a multi-step form, then drupal_process_form() issued a redirect to
// another page, or back to this page, but as a new request. Therefore, if
// we're here, it means that this is either a form being viewed initially
// before any user input, or there was a validation error requiring the form
// to be re-displayed, or we're in a multi-step workflow and need to display
// the form's next step. In any case, we have what we need in $form, and can
// return it for rendering.

return $form;

Status: Needs review » Needs work

The last submitted patch, 1: FailedFormSubmissionMsg-2239313.patch, failed testing.