- 🇬🇧United Kingdom robcarr Perthshire, Scotland
Patch #8 worked for me.
+1 for RTBC
- 🇩🇪Germany Anybody Porta Westfalica
Confirming this issue still exists in 2.x and popping up on all our projects. It fills up logs and leads to unexpected functionality. So setting the priority to major.
I'll have a look at the different patches and check, which one is correct.
- 🇩🇪Germany Anybody Porta Westfalica
So this is interesting. There are several approaches above.
There are also similar issues in other modules like:
- 🐛 Headers have already been sent after upgrade to Drupal 9.2 (can't login) Fixed
- 🐛 Failed to start the session because headers have already been sent Active
In general
return $response;
would be correct instead of:
return $response->send();
to return in the controller. For example, see https://drupalsun.com/philipnorton42/2022/05/22/drupal-9-correct-way-red...
But that doesn't seem to work as I think this comes too late or is overwritten by a core redirect for 404?
There's also a discussion on exactly this topic:
https://drupal.stackexchange.com/questions/138697/what-function-method-c...I tried
$response->send();
return;but that leads to the same error as before.
I also tried the implementation from https://blog.ricovandevin.com/redirecting-to-a-specified-destination-in-... but doesn't really seem to make much sense here.
The correct solution is #8:
// Remove unwanted destination. $this->requestStack->getCurrentRequest()->query->remove('destination'); return $response;
It redirects as expected and doesn't lead to any unwanted side-effects. I'll prepare a MR for 2.x with the code, so hopefully this can be merged asap!
- @anybody opened merge request.
- 🇩🇪Germany Anybody Porta Westfalica
- Status changed to RTBC
almost 2 years ago 8:52am 21 February 2023 - 🇩🇪Germany Grevil
LGTM!
Works as expected and fixes the Problem! RTBC +1.
-
emilymathew →
committed 1c334493 on 2.x authored by
Anybody →
Issue #3087929: Failed to start the session because headers have already...
-
emilymathew →
committed 1c334493 on 2.x authored by
Anybody →
- 🇮🇳India emilymathew
Sorry for the late response. This is merged. Thank you...
As this is an urgent issue., released new version 2.1.2 with this change.
Thank you..
- Status changed to Fixed
over 1 year ago 2:27pm 1 March 2023 Automatically closed - issue fixed for 2 weeks with no activity.