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.
Comment | File | Size | Author |
---|---|---|---|
#1 | form-2120847-1.patch | 3.87 KB | tim.plunkett |
Comments
Comment #1
tim.plunkettComment #2
dawehnerI try to understand the usecase of a form being able to return a response object.
Comment #3
tim.plunkettIn \Drupal\system\Form\ModulesListConfirmForm:
It can't wait for $form_state['redirect'] or anything.
Either way, this just adds test coverage
Comment #4
tim.plunkettTalked with Paris, this was originally added in #1668866: Replace drupal_goto() with RedirectResponse.
We cannot assume that a form is being built as a controller response directly, and this replaced arbitrary drupal_goto() calls within forms.
Comment #5
dawehnerWe should try to investigate whether we can get rid of using the http kernel but this is work for another issue.
Comment #6
webchickFor those following along at home, removing the
exit;
from sendResponse() and adding it manually where it's called allows that function to be unit tested, which is then added by this patch.There's a slight DX loss here in that you always want to call exit; when calling sendResponse() but OTOH it's clear that this isn't used very often (Tim said it should only ever be used twice, and hopefully we can get that down to once by the time D8 ships), so the win of unit testability wins out in this case.
Committed and pushed to 8.x. Thanks!