Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Error when disabling CSRF in the test environment #6803

Copy link
Copy link
Closed
@fluffur

Description

@fluffur
Issue body actions

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:

  1. Disable CSRF protection in config/packages/test/framework.yaml:
    when@test:
        framework:
            csrf_protection: false
            form:
                csrf_protection:
                    enabled: false
  2. Open the entity creation page in EasyAdmin:
    http://localhost/admin/author/new
    
  3. 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 in framework.yaml.
  • Make the csrf_token_id option optional in CrudFormType.

Additional Context:
If CSRF protection is enabled (csrf_protection: true), the form works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.