- Issue created by @sboden
- πΊπΈUnited States cilefen
Could you please perform a
git bisect
on a working copy of Drupal Core to find the commit that changed the behavior? This operation will find the commit quickly. - πΊπΈUnited States cilefen
To do this use
10.2.7
as the "good" commit and10.3.0
as the "bad" commit. I did a git bisect and end up at this one:
522404706e440106fe7e5d382ce018b0f89637d4 is the first bad commit commit 522404706e440106fe7e5d382ce018b0f89637d4 Author: Alex Pott <alex.a.pott@googlemail.com> Date: Thu Feb 22 13:05:24 2024 +0000 Issue #3414287 by catch, longwave: Avoid reading session from the database multiple times during a big pipe request (cherry picked from commit 213906e2867ddf6187bb140a3002db2c1144ab92) .../Core/Session/ResponseKeepSessionOpenInterface.php | 16 ++++++++++++++++ core/lib/Drupal/Core/StackMiddleware/Session.php | 3 ++- core/modules/big_pipe/src/Render/BigPipe.php | 12 ------------ core/modules/big_pipe/src/Render/BigPipeResponse.php | 3 ++- .../OpenTelemetryAuthenticatedPerformanceTest.php | 3 +-- .../src/FunctionalJavascript/StandardPerformanceTest.php | 4 ++-- 6 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 core/lib/Drupal/Core/Session/ResponseKeepSessionOpenInterface.php
I tried disabling bigpipe but that does not make it revert to the previous behaviour.
- π¬π§United Kingdom longwave UK
Generally you should not call
$response->send()
directly, instead you should be returning the redirect from a controller and allowing Drupal to process the response. This is part of code for a Form. An API call fails and in that case I want to go back to with an error message on .
The new behavior is that you go to but the error message doesn't show there, the error does show when you go to the form on which the exception occurred/where the error was added.
It's not breaking Drupal, but it's breaking the flow of a Drupal application when that depends on the old behavior of status messages.
- πͺπΈSpain ady1503
\Drupal::messenger()->addStatus(t('Dear %user, Welcome to our %site',['%user' => 'admin', '%site' => 'Drupal Learn'])); $response = new RedirectResponse($url->toString()); $request = \Drupal::request(); // Save the session so things like messages get saved. $request->getSession()->save(); $response->prepare($request); // Make sure to trigger kernel events. \Drupal::service('kernel')->terminate($request, $response); $response->send();
source: https://blog.birk-jensen.dk/drupal-http-redirection-from-anywhere
https://www.drupal.org/node/2023537 βWorks form mi for same problem with messenger after update to Drupal 10.3.0
Hope help.
When you need to redirect in a function that has $form_state, you can use
$form_state->setRedirect()
: that works as before.I would suggest to close the bug as chances of the root cause being reverted seem slight, and there is a viable workaround, either using $form_state->setRedirect() or the solution from #9.
But it does suck that it breaks existing functionality.