Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Security] FirewallAwareTrait throws Critical Error instead of throwing Exception #43145

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
fkropfhamer opened this issue Sep 23, 2021 · 0 comments · Fixed by #43146
Closed

Comments

@fkropfhamer
Copy link
Contributor

Symfony version(s) affected: 5.3.7

Description

The Symfony/Bundle/SecurityBundle/Security/FirewallAwareTrait throws Critical Error instead of throwing the right Exception with helpfull Message.
The Error thrown is "Call to undefined function Symfony\Bundle\SecurityBundle\LoginLink\LoginLinkHandler()".
The right Error message, I assume, would be "Cannot determine the correct Symfony\Bundle\SecurityBundle\LoginLink\LoginLinkHandler to use: there is no active Request and so, the firewall cannot be determined. Try using a specific Symfony\Bundle\SecurityBundle\LoginLink\Logi
nLinkHandler service."

How to reproduce

  1. Create new Symfony project with php 7.4 symfony new my_project_name --full
  2. Configure login link like described here
  3. Create new Command, inject LoginLinkHandlerInterface and try to call $this->loginLinkHandler->createLoginLink($user);
  4. Execute Command and take a look at the Error message.

Possible Solution

Change Symfony/Bundle/SecurityBundle/Security/FirewallAwareTrait line to
throw new \LogicException('Cannot determine the correct '.$serviceIdentifier.' to use: there is no active Request and so, the firewall cannot be determined. Try using a specific '.$serviceIdentifier.' service.');

Additional context

@fabpot fabpot closed this as completed Sep 26, 2021
fabpot added a commit that referenced this issue Sep 26, 2021
…wareTrait (fkropfhamer)

This PR was submitted for the 5.4 branch but it was squashed and merged into the 5.3 branch instead.

Discussion
----------

[SecurityBundle] Fixed LogicException message of FirewallAwareTrait

| Q             | A
| ------------- | ---
| Branch?       | 5.4 for features / 4.4 or 5.3 for bug fixes <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #43145 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch 5.x.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
-->

Commits
-------

d93da59 [SecurityBundle] Fixed LogicException message of FirewallAwareTrait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants