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

Skip to content

Commit d790f00

Browse files
committed
bug #46766 Initially set user null. (mogilvie)
This PR was submitted for the 6.2 branch but it was merged into the 6.1 branch instead. Discussion ---------- Initially set user null. getUser is ?UserInterface return, but throws unset user exception. Typed property Symfony\Component\Security\Core\Exception\AccountStatusException::$user must not be accessed before initialization | Q | A | ------------- | --- | Branch? | 6.1 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 null initialization error on getUser <!-- 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 reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - 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 the latest branch. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 71cafbc Initially set user null.
2 parents 5149f0d + 71cafbc commit d790f00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Security/Core/Exception/AccountStatusException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
abstract class AccountStatusException extends AuthenticationException
2424
{
25-
private UserInterface $user;
25+
private ?UserInterface $user = null;
2626

2727
/**
2828
* Get the user.

0 commit comments

Comments
 (0)