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.

Files: 
CommentFileSizeAuthor
#4 2108943-nonexisting_forms-v2.patch1011 bytesivanjaros
FAILED: [[SimpleTest]]: [MySQL] 58,820 pass(es), 217 fail(s), and 48 exception(s).
[ View ]
#1 2108943-nonexisting_forms.patch980 bytesivanjaros
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2108943-nonexisting_forms.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new980 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 2108943-nonexisting_forms.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Status:Needs review» Needs work

The last submitted patch, 2108943-nonexisting_forms.patch, failed testing.

Status:Needs work» Needs review

Though the last patch would not work with #1795476 (if it gets commited).

StatusFileSize
new1011 bytes
FAILED: [[SimpleTest]]: [MySQL] 58,820 pass(es), 217 fail(s), and 48 exception(s).
[ View ]

Status:Needs review» Needs work

The last submitted patch, 2108943-nonexisting_forms-v2.patch, failed testing.

To 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.

I 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.

Why is this fixed for loading entities via menu path or something like that then?

Status:Needs work» Closed (duplicate)

There'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.