8000 Unknown Twig function csrf_token · Issue #8816 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Unknown Twig function csrf_token #8816

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

Closed
Guibzs opened this issue Dec 3, 2017 · 4 comments 8000
Closed

Unknown Twig function csrf_token #8816

Guibzs opened this issue Dec 3, 2017 · 4 comments
Labels
bug hasPR A Pull Request has already been submitted for this issue. Security Status: Reviewed

Comments

@Guibzs
Copy link
Guibzs commented Dec 3, 2017

See symfony-docs/security/csrf_in_login_form.rst

There's no more csrf_token function included in twig since Symfony 4.0.
Or is there a missing composer require ?

@xabbuh
Copy link
Member
xabbuh commented Dec 4, 2017

You are right. This becomes a bit tricky when using Symfony 4. The "easy" solution is to install the Form component for the function to be available. If you want to solve this in a cleaner way, you may want to implement the function yourself. You can take a look at symfony/symfony#25197 to see how easy this is in fact.

@javiereguiluz javiereguiluz added the hasPR A Pull Request has already been submitted for this issue. label Dec 4, 2017
@javiereguiluz
Copy link
Member

@Guibzs good catch. The good solution will come in Symfony 4.1 thanks to the change made by @xabbuh, but meanwhile we c 8000 an improve this article as proposed in #8821.

@javiereguiluz javiereguiluz changed the title Unknonw Twig function csrf_token Unknown Twig function csrf_token Dec 4, 2017
@curry684
Copy link
Contributor

Ran into same issue just now, so we can at least mark this confirmed ;)

Status: reviewed

@javiereguiluz
Copy link
Member

Fixed by #8873.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug hasPR A Pull Request has already been submitted for this issue. Security Status: Reviewed
Projects
None yet
Development

No branches or pull requests

5 participants
0