Description
Description:
When CSRF protection is disabled in framework.yaml
for the test environment, an error occurs when trying to access the entity creation page (/admin/author/new
).
Steps to Reproduce:
- Disable CSRF protection in
config/packages/test/framework.yaml
:when@test: framework: csrf_protection: false form: csrf_protection: enabled: false
- Open the entity creation page in EasyAdmin:
http://localhost/admin/author/new
- The following error occurs:
An error has occurred resolving the options of the form "EasyCorp\Bundle\EasyAdminBundle\Form\Type\CrudFormType": The option "csrf_token_id" does not exist. Defined options are: "action", "allow_extra_fields", "allow_file_upload", "attr", ..., "validation_groups".
Expected Behavior:
EasyAdmin should work correctly without CSRF protection in the test environment or at least provide a more descriptive error message.
Actual Behavior:
The form fails with the error: The option "csrf_token_id" does not exist
.
Environment:
- Symfony:
7.1.11
- EasyAdminBundle:
4.23.3
- PHP:
8.2
Possible Solutions:
- Ensure EasyAdmin respects the
csrf_protection: false
setting inframework.yaml
. - Make the
csrf_token_id
option optional inCrudFormType
.
Additional Context:
If CSRF protection is enabled (csrf_protection: true
), the form works correctly.
Metadata
Metadata
Assignees
Labels
No labels