8000 [Form][FrameworkBundle] Regression with configuration of default CSRF Tokens · Issue #59867 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form][FrameworkBundle] Regression with configuration of default CSRF Tokens #59867

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

Open
PhilETaylor opened this issue Feb 26, 2025 · 1 comment

Comments

@PhilETaylor
Copy link
Contributor

Symfony version(s) affected

7.2.4

Description

regression caused by #59728

Symfony\Component\Security\Csrf\CsrfTokenManager::getToken(): Argument #1 ($tokenId) must be of type string, null given, called in /app/vendor/symfony/form/Extension/Csrf/Type/FormTypeCsrfExtension.php on line 80

Seems passing any array to the setAttributes causes this unless you pass csrf_token_id value in that array, there is no sane default applied.

In my case I was passing other attributes in this array, but not the csrf_token_id, as that was not needed before today.

How to reproduce

Minimum reproducer is

$this->createFormBuilder()->setAttributes([/* blank array, or some other key pairs, not including csrf_token_id*/])->getForm()->createView();

Possible Solution

No response

Additional Context

related change https://github.com/symfony/symfony/pull/59728/files#diff-438ae1976074de3d600070f2d02f4e87bcbc847d7826ca8aaeadc4231c5d701f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0