FormState::setIgnoreDestination does not work with external redirects

Created on 13 August 2024, 4 months ago
Updated 14 August 2024, 4 months ago

Problem/Motivation

When creating a redirect from a form submit handler, the request's destination query param is honored, negating the intended redirect. To prevent this, $form_state->setIngoreDestination() was added in the related issue. However, it was added to RedirectForm(), which is not called when creating an external redirect by setting the form_state's response to a TrustedRedirectResponse

Steps to reproduce

In a form submit handler for (say) the login form which has a destination to the same page, create a TrustedRedirectResonse to an external site, set the response, call setIngoreDestination() and observe that the external redirect intended is replaceed with the form's destination.

Proposed resolution

Move the check for ingoreDestination out of RedirectForm, or check it additionally when processing a form_state's response.

Release notes snippet

Update the documentation and/or release note for the related issue.

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Request processing 

Last updated 3 days ago

No maintainer
Created by

🇺🇸United States DanChadwick

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024