When submitting the node form using a non-button AJAX element, you get:

Warning: end() expects parameter 1 to be array, null given in file_managed_file_validate() (line 536 of modules/file/file.module).

This is because the file validation assume that the form is always submitted by pressing a button.

Comments

damien tournoud’s picture

Status: Active » Needs review
StatusFileSize
new1017 bytes

Easy to patch. Not sure how to test that.

Mr 13’s picture

Status: Needs review » Needs work

The last submitted patch, 1031412-file-validate-button.patch, failed testing.

damien tournoud’s picture

Status: Needs work » Needs review

#1: 1031412-file-validate-button.patch queued for re-testing.

andypost’s picture

Duplicate issue #1049462: Usage of deprecated $form_state['clicked_button'] causes bugs during AJAX submissions by non-buttons has a more sophisticated patch

Do we really need this to change globally maybe better to fix 'clicked_button' itself within formapi?

rfay’s picture

Since $form_state['clicked_button'] is deprecated, I would prefer to remove its usages (but not its current support in D7) as in the patch in #1049462: Usage of deprecated $form_state['clicked_button'] causes bugs during AJAX submissions by non-buttons.

However, I would like to know what execution path avoids the initialization of $form_state['clicked_button']. That's not supposed to happen.

rfay’s picture

StatusFileSize
new6.67 KB

Here is the patch. I haven't tried it for this use-case, but I imagine it fixes it.

rfay’s picture

Status: Needs review » Closed (duplicate)

Do you mind if we reverse the duplicate marking? This one deals with only one place this is happening; the other describes the underlying problem.

Marking as duplicate of #1049462: Usage of deprecated $form_state['clicked_button'] causes bugs during AJAX submissions by non-buttons