Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Fixing previous url #27935

Merged
merged 1 commit into from Mar 19, 2019

Conversation

Projects
None yet
3 participants
@veencel
Copy link

veencel commented Mar 19, 2019

Currently, the previous url is set too early in the StartSession middleware.
When the referrer header is missing, the back() call always redirects to the current URL creating a redirect loop.

I think this commit introduced this bug, setting the url after calling the $next callback solves the issue.

Vencel Kátai
@driesvints

This comment has been minimized.

Copy link
Member

driesvints commented Mar 19, 2019

I believe this is indeed the culprit. I was just investigating this myself and think the reversal of the sequence in which these calls were made indeed broke it. But this definitely needs a test or otherwise this will break again.

#27894 (comment)

@@ -53,12 +53,12 @@ public function handle($request, Closure $next)
$this->collectGarbage($session);
$this->storeCurrentUrl($request, $session);
$this->addCookieToResponse(
$response = $next($request), $session

This comment has been minimized.

Copy link
@driesvints

driesvints Mar 19, 2019

Member

Instead of writing this like so in which the next call gets lost in the other call this might be a more obvious approach:

        $response = $next($request);

        $this->storeCurrentUrl($request, $session);
        $this->addCookieToResponse($response, $session);

@driesvints driesvints changed the title Fixing previous url [5.8] Fixing previous url Mar 19, 2019

@taylorotwell taylorotwell merged commit be3c8ba into laravel:5.8 Mar 19, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@veencel veencel deleted the veencel:previous-url-fix branch Mar 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.