Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If I call a form that does not exist(or is defined in non-loaded file) I'll get notice and warning but the form will be displayed.
In addition, if I use form altering hooks(hook_form_alter, hook_form_FORM_ID_alter, hook_form_BASE_FORM_ID_alter) I can put form elements into this non-existing form(though validation and submit functions won't get called).
I think non-existing form should not be rendered at all and it should not call form altering hooks either.
Comment | File | Size | Author |
---|---|---|---|
#4 | 2108943-nonexisting_forms-v2.patch | 1011 bytes | Anonymous (not verified) |
#1 | 2108943-nonexisting_forms.patch | 980 bytes | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedThough the last patch would not work with #1795476 (if it gets commited).
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedTo pass the tests, they themselves have to be altered to reflect this change and that is a task for someone with more knowledge of all Drupal's tests so I rather leave it to someone else.
Comment #7
swentel CreditAttribution: swentel commentedI don't see why we should be protecting this. If it doesn't exist, it there's a problem with the calling code, not in core.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedWhy is this fixed for loading entities via menu path or something like that then?
Comment #9
swentel CreditAttribution: swentel commentedThere's a duplicate actually, see #979686: Non-existing form_id can be retrieved, prepared, processed, and even executed - forms are not dynamic like content or menu paths. If there's an error, it's really easy to fix and then we're done really.