Problem/Motivation

Currently FormBuilder::retrieveForm() examines the result returned by a form builder function. If it is a response, it will send it to the browser and exit. As per #2230121: Remove exit() from FormBuilder this behavior is incompatible with the HTTP kernel because it gives any form whether it is rendered in the main content area or in a block the power to completely break the normal request/response flow.

Proposed resolution

Trigger a E_USER_DEPRECATED when form builder methods return response objects and fix affected forms in core - instead having them throw a EnforcedResponseException.
Add a EnforcedResponseException::redirectToUrl factory method to simplify this process

Remaining tasks

Get tests green
Reviews
Change notice
Release notes snippet

User interface changes

API changes

CommentFileSizeAuthor
#86 2363189-86.patch11.43 KBshivam-kumar
#84 2363189-83.patch11.27 KBNivethaSubramaniyan
#83 interdiff_81-82.txt1.05 KBNivethaSubramaniyan
#83 2363189-82.patch11.5 KBNivethaSubramaniyan
#81 2363189-81.patch11.3 KBlarowlan
#81 2363189-81-interdiff.txt9.53 KBlarowlan
#72 drupal-2363189-72-form-redirect.patch6.73 KBgeek-merlin
#70 drupal-2363189-70-form-redirect.patch1.5 KBgeek-merlin
#67 drupal-2363189-66-form-redirect.patch1.48 KBgeek-merlin
#55 2363189-55.patch22.84 KBlokapujya
#55 interdiff-2363189-54.txt4.89 KBlokapujya
#53 do_not_allow_form-2363189-53.patch19.38 KBneetu morwani
#50 2363189-50.patch24.03 KBrpayanm
#46 2363189-form-46.patch25.66 KBmartin107
#46 interdiff-45-46.txt2.07 KBmartin107
#45 2363189-form-45.patch24.72 KBmartin107
#45 interdiff-44-45.txt716 bytesmartin107
#44 2363189-form-44.patch24.51 KBmartin107
#44 interdiff-42-44.txt615 bytesmartin107
#42 interdiff-40-42.txt1.95 KBmartin107
#42 2363189-form-42.patch24.53 KBmartin107
#40 ConfirmUninstallBadSubmit.jpg26.07 KBmartin107
#40 interdiff-38-40.txt3.19 KBmartin107
#40 2363189-form-40.patch24.22 KBmartin107
#38 interdiff-29-38.txt6.12 KBmartin107
#38 2363189-form-38.patch24.02 KBmartin107
#29 2363189-form-29.patch24.33 KBmartin107
#24 2363189-form-24.patch25.14 KBznerol
#20 2363189-form-19.patch5.57 KBtim.plunkett
#18 interdiff.txt619 bytestim.plunkett
#18 2363189-form-18.patch25 KBtim.plunkett
#16 interdiff.txt8.11 KBtim.plunkett
#16 2363189-form-16.patch24.99 KBtim.plunkett
#12 interdiff.txt6.96 KBtim.plunkett
#12 2363189-form-12.patch23.95 KBtim.plunkett
#9 2363189-form-9.patch19.63 KBtim.plunkett
#7 2363189-form-7.patch20.35 KBtim.plunkett
#7 interdiff.txt7.77 KBtim.plunkett
#6 interdiff.txt5.91 KBtim.plunkett
#6 2363189-form-6.patch13.14 KBtim.plunkett
#4 2363189-form-4.patch7.23 KBtim.plunkett
#1 2363189-deprecate-response-from-builder-methods.diff635 bytesznerol
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

znerol’s picture

Status: Active » Needs review
FileSize
635 bytes

Let's see how this breaks.

Status: Needs review » Needs work

The last submitted patch, 1: 2363189-deprecate-response-from-builder-methods.diff, failed testing.

tim.plunkett’s picture

We used to have more of these. LanguageDeleteForm::buildForm() seems to be the only usage left.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
7.23 KB

Needed to update the coverage for sendResponse to use the other call to it now that we're removing this one.

Status: Needs review » Needs work

The last submitted patch, 4: 2363189-form-4.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
13.14 KB
5.91 KB

I don't think this is actually possible to prevent. We should have a dozen more failures than we do, which means missing test coverage.

Look at ViewsFormBase::getForm() and UserMultipleCancelConfirm::buildForm() and explain how we're going to fix those.

Instead, we need to try again at allowing forms to *properly* redirect when they are functioning as controllers.
If that means that FormBuilder needs a separate buildFormAsController method that is called from Drupal\Core\Controller\FormController, then so be it.

tim.plunkett’s picture

Component: base system » forms system
FileSize
7.77 KB
20.35 KB

Here are some more fixes and test coverage. This should fail.
And I haven't touched ViewsFormBase yet.

Status: Needs review » Needs work

The last submitted patch, 7: 2363189-form-7.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
19.63 KB

Made a mistake with that, ViewsFormBase doesn't use _form, it's _content.

Crell’s picture

In IRC I suggested an extra interface with a dedicated method that forms can implement. If they do, then when used as a controller (only) that is called before buildForm() is, and it can either return a (redirect?) response (in which case buildForm is never called) or null, in which case buildForm() is called. That has the added advantage of separating the "should this form even happen" logic from the form definition itself.

While it may result in a little code duplication, I suspect factoring the code in the form class to separate methods will eliminate most of it, enough that I'm not worried about it.

Status: Needs review » Needs work

The last submitted patch, 9: 2363189-form-9.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
23.95 KB
6.96 KB

This needs work and I don't have the time to work on it, but this might help.

dawehner’s picture

Well, we could convert many of those instances to use a custom controller which uses a form controller and set the redirect outside of it.

znerol’s picture

In IRC I suggested an extra interface with a dedicated method that forms can implement. If they do, then when used as a controller (only) that is called before buildForm() is, and it can either return a (redirect?) response (in which case buildForm is never called) or null, in which case buildForm() is called.

Then we also should prevent that forms implementing that interface are rendered outside their controller. Because then the method will not be called and that may lead to weird issues.

I'd rather go for #13, there are only a couple of instances in core which are easy to convert I guess.

znerol’s picture

A quick and dirty way to find all form builder functions which potentially attempt to redirect / return a result. Apply the script on a fresh clone (not your usual working directory), sed will remove anything from the source files outside the form builder functions.

git grep -l 'function.*buildForm(' > /tmp/forms.txt
xargs  sed '0,/function.*buildForm(/d' -i < /tmp/forms.txt
xargs  sed '/function.*(/,$d' -i < /tmp/forms.txt
git ls-files --modified | xargs git grep -liE 'redirect|response'
core/lib/Drupal/Core/Form/FormBuilder.php
core/lib/Drupal/Core/Installer/Form/SelectLanguageForm.php
core/modules/comment/src/Form/ConfirmDeleteMultiple.php
core/modules/config/src/Form/ConfigImportForm.php
core/modules/forum/src/Form/Overview.php
core/modules/language/src/Form/LanguageDeleteForm.php
core/modules/language/src/Form/NegotiationSessionForm.php
core/modules/language/src/Form/NegotiationUrlForm.php
core/modules/node/src/Form/DeleteMultiple.php
core/modules/simpletest/src/Form/SimpletestResultsForm.php
core/modules/system/src/Form/ModulesListConfirmForm.php
core/modules/system/src/Form/ModulesUninstallConfirmForm.php
core/modules/system/src/Form/PerformanceForm.php
core/modules/system/tests/modules/ajax_forms_test/src/Form/AjaxFormsTestLazyLoadForm.ph
core/modules/system/tests/modules/form_test/src/Form/FormTestRedirectForm.php
core/modules/user/src/Form/UserMultipleCancelConfirm.php

This list includes some false positives, obviously FormBuilder and also PerformanceForm. The latter matches because of '#default_value' => $config->get('response.gzip'),. I am unsure about NegotiationSessionForm and NegotiationUrlForm, they unconditionally call $form_state->setRedirect('language.negotiation');.

tim.plunkett’s picture

FileSize
24.99 KB
8.11 KB

Here it is without the additional interface.

Status: Needs review » Needs work

The last submitted patch, 16: 2363189-form-16.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
25 KB
619 bytes

That's important :)
Plus a 25K patch is much better than a 24.99K patch

Crell’s picture

+++ b/core/lib/Drupal/Core/Form/FormBuilder.php
@@ -416,10 +416,8 @@ public function retrieveForm($form_id, FormStateInterface &$form_state) {
+      throw new \UnexpectedValueException('Form builder functions must return arrays');

Replace "Array" with "Form array structure" to be clearer about the data "type" that is expected.

Using _content here is fine by me, too. Although, if we're going to put getForm() on the form class itself would it make sense to standardize that, much as we do create() on controllers? Which... becomes the interface suggestion all over again? :-)

tim.plunkett’s picture

FileSize
5.57 KB

Here's a completely different approach. It doesn't require module authors to do anything differently for the 99.99% use case.

tim.plunkett’s picture

tim.plunkett’s picture

Status: Needs review » Closed (duplicate)

Thanks for the substantive reviews.

znerol’s picture

Status: Closed (duplicate) » Needs work

As per the @todo introduced in #2230121: Remove exit() from FormBuilder, it is still necessary to implement #18. We cannot continue to allow form builder methods to return responses.

znerol’s picture

Status: Needs work » Needs review
FileSize
25.14 KB

Reroll #18.

znerol’s picture

  1. +++ b/core/modules/language/src/LanguageAccessControlHandler.php
    @@ -23,17 +23,24 @@ class LanguageAccessControlHandler extends EntityAccessControlHandler {
    +    if ($operation == 'update') {
    ...
    +    elseif ($operation == 'delete') {
    

    Use the identity operator (===).

  2. +++ b/core/modules/node/src/Form/DeleteMultiple.php
    @@ -97,9 +97,12 @@ public function getConfirmText() {
         if (empty($this->nodes)) {
    -      return new RedirectResponse($this->getCancelUrl()->setAbsolute()->toString());
    +      $node_temp_store->delete($current_user_id);
    +      throw new AccessDeniedHttpException();
    

    Not sure whether this is good UX. What about displaying a message that the selection is empty and also hide the submit button?

  3. +++ b/core/modules/simpletest/simpletest.routing.yml
    @@ -17,7 +17,7 @@ simpletest.test_form:
    -    _form: 'Drupal\simpletest\Form\SimpletestResultsForm'
    +    _content: 'Drupal\simpletest\Form\SimpletestResultsForm::getForm'
    
    +++ b/core/modules/simpletest/src/Form/SimpletestResultsForm.php
    @@ -106,16 +106,22 @@ public function getFormId() {
    +  public function getForm($test_id = NULL) {
    +    if (is_numeric($test_id) && !$results = $this->getResults($test_id)) {
    +      drupal_set_message($this->t('No test results to display.'), 'error');
    +      return $this->redirect('simpletest.test_form');
    +    }
    +    return $this->formBuilder()->getForm($this, $test_id);
    +  }
    +
    +  /**
    +   * {@inheritdoc}
    +   */
       public function buildForm(array $form, FormStateInterface $form_state, $test_id = NULL) {
         $this->buildStatusImageMap();
         // Make sure there are test results to display and a re-run is not being
         // performed.
    -    $results = array();
    -
    -    if (is_numeric($test_id) && !$results = $this->getResults($test_id)) {
    -      drupal_set_message($this->t('No test results to display.'), 'error');
    -      return new RedirectResponse($this->url('simpletest.test_form', array(), array('absolute' => TRUE)));
    -    }
    +    $results = is_numeric($test_id) ? $this->getResults($test_id) : [];
    

    I like that approach much better than the one above.

  4. +++ b/core/modules/system/src/Form/ModulesListConfirmForm.php
    @@ -107,7 +108,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    -      return $this->redirect('system.modules_list');
    +      throw new AccessDeniedHttpException();
    

    Same concerns as above.

  5. +++ b/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
    @@ -133,7 +133,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    -      return new RedirectResponse('/admin/modules/uninstall');
    +      throw new AccessDeniedHttpException();
    

    Same concerns as above.

  6. +++ b/core/modules/views_ui/src/Form/Ajax/ViewsFormBase.php
    @@ -157,7 +157,7 @@ public function getForm(ViewStorageInterface $view, $display_id, $js) {
    -      return new RedirectResponse($this->url('entity.view.edit_display_form', ['view' => $view->id(), 'display_id' => $display_id], ['absolute' => TRUE]));
    +      return $this->redirect('entity.view.edit_display_form', ['view' => $view->id(), 'display_id' => $display_id]);
    

    It looks like this is only invoked if the form was retrieved from the non-js route. Do we have test-coverage for that case? It looks to me that this should fail with an InvalidValueException because this looks like a form builder function.

  7. +++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
    @@ -356,19 +356,34 @@ public function testGetCache() {
    +   * @covers ::sendResponse
    

    FormBuilder::sendResponse() does not exist anymore. I think this test is obsolete now.

Status: Needs review » Needs work

The last submitted patch, 24: 2363189-form-24.patch, failed testing.

andypost’s picture

  1. +++ b/core/modules/language/src/Form/LanguageDeleteForm.php
    @@ -88,13 +88,6 @@ public function getFormId() {
    -    // Warn and redirect user when attempting to delete the default language.
    ...
    -      return new RedirectResponse($url);
    ...
         // Throw a 404 when attempting to delete a non-existing language.
         $languages = language_list();
         if (!isset($languages[$langcode])) {
    

    Suppose access checker should do that!

  2. +++ b/core/modules/node/src/Form/DeleteMultiple.php
    @@ -97,9 +97,12 @@ public function getConfirmText() {
         if (empty($this->nodes)) {
    -      return new RedirectResponse($this->getCancelUrl()->setAbsolute()->toString());
    +      $node_temp_store->delete($current_user_id);
    +      throw new AccessDeniedHttpException();
    

    That needs a code comment, also 403 is a strange way to break flow.
    Maybe better to wrap that logic into controller?

  3. +++ b/core/modules/simpletest/simpletest.routing.yml
    @@ -17,7 +17,7 @@ simpletest.test_form:
    -    _form: 'Drupal\simpletest\Form\SimpletestResultsForm'
    +    _content: 'Drupal\simpletest\Form\SimpletestResultsForm::getForm'
    
    +++ b/core/modules/simpletest/src/Form/SimpletestResultsForm.php
    @@ -8,19 +8,19 @@
    -class SimpletestResultsForm extends FormBase {
    +class SimpletestResultsForm extends ControllerBase implements FormInterface {
    
    @@ -106,16 +106,22 @@ public function getFormId() {
    +  public function getForm($test_id = NULL) {
    +    if (is_numeric($test_id) && !$results = $this->getResults($test_id)) {
    +      drupal_set_message($this->t('No test results to display.'), 'error');
    
    @@ -252,6 +258,12 @@ public function buildForm(array $form, FormStateInterface $form_state, $test_id
    +  public function validateForm(array &$form, FormStateInterface $form_state) {
    +  }
    

    good trick

  4. +++ b/core/modules/system/src/Form/ModulesListConfirmForm.php
    @@ -107,7 +108,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
         // Redirect to the modules list page if the key value store is empty.
         if (!$this->modules) {
    ...
    +      throw new AccessDeniedHttpException();
    

    I think it would be great to add some usable error message here and other similar places.

dawehner’s picture

Issue tags: +Needs reroll

Let's get some push behind this again. First let's someone reroll it.

martin107’s picture

Status: Needs work » Needs review
FileSize
24.33 KB

One trivial conflict to resolve, lots of merging and auto-merging going on

That it installs is all I can guarentee ... let us see what testbot says

Status: Needs review » Needs work

The last submitted patch, 29: 2363189-form-29.patch, failed testing.

martin107’s picture

Assigned: Unassigned » martin107

I can see a way to resolve at least some of the broken tests

the function definition of

FormBuilderInterface::submitForm() has changed since this patch was last modified ...

I will fix this up.

tim.plunkett’s picture

Priority: Critical » Major
Issue tags: +Needs issue summary update

This needs the "beta evaluation" criteria added.
I don't see how this should block release.

znerol’s picture

Then we should at least document that returning responses from form builders is deprecated before release. Otherwise contrib will likely pick up that pattern and fixing post-release will be kind of an API change.

almaudoh’s picture

Priority: Major » Critical
Issue tags: -Needs issue summary update
  1. +++ b/core/modules/simpletest/simpletest.routing.yml
    @@ -17,7 +17,7 @@ simpletest.test_form:
    +    _content: 'Drupal\simpletest\Form\SimpletestResultsForm::getForm'
    
    +++ b/core/modules/user/user.routing.yml
    @@ -78,7 +78,7 @@ entity.user_role.edit_permissions_form:
    +    _content: '\Drupal\user\Form\UserMultipleCancelConfirm::getForm'
    

    HEAD now uses _controller instead of _content

  2. +++ b/core/modules/system/src/Form/ModulesListConfirmForm.php
    @@ -119,7 +120,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +      throw new AccessDeniedHttpException();
    
    +++ b/core/modules/system/src/Form/ModulesUninstallConfirmForm.php
    @@ -133,7 +133,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +      throw new AccessDeniedHttpException();
    

    Should this not have a message explaining why access is denied? Is that the right Exception to throw?

almaudoh’s picture

Priority: Critical » Major
Issue tags: -Needs reroll +Needs issue summary update

Cross-post

martin107’s picture

Assigned: martin107 » Unassigned

Looking at FormBuilderTest

Stepping through the code, the mocks in testSendResponse() expect the dispatch and terminate events to fire. This is the reported error.

Actually what is happening in FormBubmitter::doSubmitForm() a response is set

and then FormBuilder::getForm() throws and error diverting the normal flow of code out of balance.

So this is interlinked with this issue...

#2367555: Deprecate EnforcedResponseException support

It may take sometime to find a common way forward.

Please ignore my comment from #31 .. I will file a separate issue.

martin107’s picture

Status: Needs work » Needs review
FileSize
24.02 KB
6.12 KB

From #25

FormBuilder::sendResponse() does not exist anymore. I think this test is obsolete now.

Yes.. wish I had seen that earlier :)

I also fixed the others from #25 all except 6.

This look a better way to control error paths, in the short term the error count should increase .. but not too much!

Status: Needs review » Needs work

The last submitted patch, 38: 2363189-form-38.patch, failed testing.

martin107’s picture

Status: Needs work » Needs review
FileSize
24.22 KB
3.19 KB
26.07 KB

I typed 'action' when I meant 'actions' so the submit buttons were not deleted, In these corner cases when a malformed/hacked form is submitted.

I have simplified the text I added in #38, and made the message text better. I am providing a sample screenshot to show the response

Status: Needs review » Needs work

The last submitted patch, 40: 2363189-form-40.patch, failed testing.

martin107’s picture

Status: Needs work » Needs review
FileSize
24.53 KB
1.95 KB

1) #34.1 as per https://www.drupal.org/node/2378809 now using _controller

2) SimpleResultsForm::getForm - should be on an interface but is not. Just providing an initial annotation,
Something bugs me about it that I cannot articulate - documenting it oftens helps.... the return complex type seems inelegant
[ This is just a note to myself to revisit it. :) ]

Status: Needs review » Needs work

The last submitted patch, 42: 2363189-form-42.patch, failed testing.

martin107’s picture

Status: Needs work » Needs review
FileSize
615 bytes
24.51 KB

UninstallTest now passes ... so this should be back to green.

I thought this logic, from \Drupal\system\Form\ModulesUninstallConfirmForm was being exercised...

    // Cancel is the only option when the module list is empty.
    if (empty($this->modules)) {
      drupal_set_message('There are no modules to uninstall.', 'error');
      $form = parent::buildForm($form, $form_state);
      unset($form['actions']['submit']);
      $form['description']['#markup'] = 'Press cancel to return.';
      return $form;
    }

turns out this has the last word... this is fine by me. ( \Drupal\system\Form\ModulesUninstallForm )

  public function validateForm(array &$form, FormStateInterface $form_state) {
    // Form submitted, but no modules selected.
    if (!array_filter($form_state->getValue('uninstall'))) {
      $form_state->setErrorByName('', $this->t('No modules selected.'));
    }
  }
martin107’s picture

FileSize
716 bytes
24.72 KB

Added test to cover the new code in \Drupal\system\Form\ModulesUninstallConfirmForm()

martin107’s picture

FileSize
2.07 KB
25.66 KB

Added tests to cover the new code in \Drupal\system\Form\ModulesListConfirmForm.

plus a couple of trivial tweaks.

mgifford queued 46: 2363189-form-46.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 46: 2363189-form-46.patch, failed testing.

martin107’s picture

Issue tags: +Needs reroll
rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
24.03 KB
Mile23’s picture

Issue tags: +Needs reroll
Mile23’s picture

Status: Needs review » Needs work
neetu morwani’s picture

Status: Needs work » Needs review
FileSize
19.38 KB

Status: Needs review » Needs work

The last submitted patch, 53: do_not_allow_form-2363189-53.patch, failed testing.

lokapujya’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
4.89 KB
22.84 KB

The point of this issue is that from builders should not return response objects. So, I am adding back the conversions that were removed in the reroll.

Status: Needs review » Needs work

The last submitted patch, 55: 2363189-55.patch, failed testing.

tim.plunkett’s picture

Version: 8.0.x-dev » 8.1.x-dev
Priority: Major » Normal

Now that 8.0.x is out, we can't add an exception there anymore.
Also I understood the major-ness of removing exit, but now with \Drupal\Core\Form\EnforcedResponse and \Drupal\Core\EventSubscriber\EnforcedFormResponseSubscriber, is this really that major anymore?

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

geek-merlin’s picture

Here's the simplest possible stab to deprecate this. Let's see what breaks.

geek-merlin’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 67: drupal-2363189-66-form-redirect.patch, failed testing. View results

geek-merlin’s picture

Status: Needs work » Needs review
FileSize
1.5 KB

Verbosified message.

Status: Needs review » Needs work

The last submitted patch, 70: drupal-2363189-70-form-redirect.patch, failed testing. View results

geek-merlin’s picture

Status: Needs work » Needs review
FileSize
6.73 KB

Got em all?

Status: Needs review » Needs work

The last submitted patch, 72: drupal-2363189-72-form-redirect.patch, failed testing. View results

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

larowlan’s picture

+++ b/core/lib/Drupal/Core/Form/FormBase.php
@@ -211,8 +211,13 @@ protected function currentUser() {
+   * @deprecated in Drupal 9.1.x and will be removed before 10.0.0. Throw a
...
+    @trigger_error(__METHOD__ . ' is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Throw a \Drupal\Core\Form\EnforcedResponseException instead. See https://www.drupal.org/node/2363189. Current form ID: ' . $this->getFormId(), E_USER_DEPRECATED);

We'll need to update these to 10.1 and 11.0 now

All the test fails are because we're passing a Url instead of a Response, which I think means all of the Url objects need to wrapped in a RedirectResponse - so maybe its worth adding a new factory method on EnforcedResponseException e.g throw new EnforcedResponseException::redirectToUrl($url)

larowlan’s picture

Updated issue summary

larowlan’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
9.53 KB
11.3 KB

Added the factory method, hopefully this helps get tests greener

larowlan’s picture

NivethaSubramaniyan’s picture

Fixing CCF in #81

NivethaSubramaniyan’s picture

FileSize
11.27 KB

Fixing CCF

Status: Needs review » Needs work

The last submitted patch, 84: 2363189-83.patch, failed testing. View results

shivam-kumar’s picture

Fixed errors generated in #84. Have changed reference of formRoutes. It may help in error to be solved.

ayush.khare’s picture

Status: Needs work » Needs review
larowlan’s picture

Status: Needs review » Needs work

Tests still failing

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.