8000 [Security][DX] Deprecate/warn having the security bundle loaded, but not having any config · Issue #47593 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Security][DX] Deprecate/warn having the security bundle loaded, but not having any config #47593
Closed
@dkarlovi

Description

@dkarlovi

Symfony version(s) affected

5.4.11

Description

Currently, if you don't have any security config, the Security bundle skips loading any of its conifg:

if (!array_filter($configs)) {
return;
}

This can lead to weird errors like:

Did you forget to run "composer require symfony/twig-bundle"? Unknown function "is_granted" in "template.html.twig".

The developer is left to debug why Twig bundle is not being loaded, why the Security bundle is not loaded (they both are) (I'd argue that this itself is a bug).

How to reproduce

  1. Create a new symfony project
  2. don't define any security
  3. try to use some security related feature (like the mentioned Twig function) and see the error message

Possible Solution

  • warn about security not having any config (AFAIK it needs at least one firewall)
  • load some (most) services into the container even without the config

Additional Context

This happens if you're setting up a tiny Symfony app for functional tests where you need the smallest working config, you might omit things you're not directly interested in, but that can have unintended consequences which are hard to debug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDXDX = Developer eXperience (anything that improves the experience of using Symfony)DX = Developer eXperience (anything that improves the experience of using Symfony)SecurityBundleStatus: Reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0