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
Merged

Conversation

veencel
Copy link

@veencel 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.

@driesvints
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@veencel veencel deleted the previous-url-fix branch March 19, 2019 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants