8000 bug #51612 [Security] Fix for TraceableAuthenticator debug when no Au… · symfony/symfony@cae4ccd · GitHub
[go: up one dir, main page]

Skip to content

Commit cae4ccd

Browse files
committed
bug #51612 [Security] Fix for TraceableAuthenticator debug when no Auth (PhilETaylor)
This PR was merged into the 6.4 branch. Discussion ---------- [Security] Fix for TraceableAuthenticator debug when no Auth | Q | A | ------------- | --- | Branch? | 6.4 | 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 #51585 (comment) | License | MIT Fixes regression in PR #51585 and adds unit test ![image](https://github.com/symfony/symfony/assets/400092/8645c3c4-1827-4dce-83b6-a1cdace8dfb1) Commits ------- a9d36a5 Fix for TraceableAuthenticator debug when no Auth
2 parents 31cb1a2 + a9d36a5 commit cae4ccd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static function (BadgeInterface $badge): array {
5454
'resolved' => $badge->isResolved(),
5555
];
5656
},
57-
$this->passport->getBadges(),
57+
$this->passport?->getBadges() ?? [],
5858
),
5959
];
6060
}

src/Symfony/Component/Security/Http/Tests/Authenticator/Debug/TraceableAuthenticatorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,14 @@ public function testGetInfo()
3636
$this->assertSame($passport, $traceable->authenticate($request));
3737
$this->assertSame($passport, $traceable->getInfo()['passport']);
3838
}
39+
40+
public function testGetInfoWithoutAuth()
41+
{
42+
$authenticator = $this->createMock(AuthenticatorInterface::class);
43+
44+
$traceable = new TraceableAuthenticator($authenticator);
45+
$this->assertNull($traceable->getInfo()['passport']);
46+
$this->assertIsArray($traceable->getInfo()['badges']);
47+
$this->assertSame([], $traceable->getInfo()['badges']);
48+
}
3949
}

0 commit comments

Comments
 (0)
0