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

[6.x] Convert Responsables to Response objects in VerifyCsrfToken #29972

Conversation

sebastiandedeyne
Copy link
Contributor

@sebastiandedeyne sebastiandedeyne commented Sep 12, 2019

When VerifyCsrfToken tries to add cookies to a Responsable object, it triggers an error that the headers property is undefined.

The underlying problem is that if the Responsable hasn't been transformed to a response yet, the $headers doesn't necessarily exist.

This PR adds an instanceof check to the $response variable. If it's a Responsable, it will transform it to a Response object first.

Closes #29845

@driesvints
Copy link
Member

@sebastiandedeyne you might want to add an explanation why this is needed instead of linking to an issue. Otherwise your pr will probably be closed.

@driesvints driesvints changed the title Convert Responsables to Response objects in VerifyCsrfToken [6.x] Convert Responsables to Response objects in VerifyCsrfToken Sep 12, 2019
@sebastiandedeyne
Copy link
Contributor Author

Sorry, updated the description!

@taylorotwell taylorotwell merged commit 1235dcf into laravel:6.x Sep 12, 2019
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.

VerifyCsrfToken doesn't play well with Responsables
3 participants