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

Skip to content

Commit 3b3f87f

Browse files
minor #44837 [Security] make login link handler tests time sensitive (xabbuh)
This PR was merged into the 5.3 branch. Discussion ---------- [Security] make login link handler tests time sensitive | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | https://ci.appveyor.com/project/fabpot/symfony/builds/42030777#L735 | License | MIT | Doc PR | Commits ------- 40f2f4d make login link handler tests time sensitive
2 parents b8e816c + 40f2f4d commit 3b3f87f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/Symfony/Component/Security/Http/LoginLink/LoginLinkHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public function __construct(UrlGeneratorInterface $urlGenerator, UserProviderInt
4646

4747
public function createLoginLink(UserInterface $user, Request $request = null): LoginLinkDetails
4848
{
49-
$expiresAt = new \DateTimeImmutable(sprintf('+%d seconds', $this->options['lifetime']));
49+
$expires = time() + $this->options['lifetime'];
50+
$expiresAt = new \DateTimeImmutable('@'.$expires);
5051

51-
$expires = $expiresAt->format('U');
5252
$parameters = [
5353
// @deprecated since Symfony 5.3, change to $user->getUserIdentifier() in 6.0
5454
'user' => method_exists($user, 'getUserIdentifier') ? $user->getUserIdentifier() : $user->getUsername(),

src/Symfony/Component/Security/Http/Tests/LoginLink/LoginLinkHandlerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ protected function setUp(): void
5252
}
5353

5454
/**
55+
* @group time-sensitive
5556
* @dataProvider provideCreateLoginLinkData
5657
*/
5758
public function testCreateLoginLink($user, array $extraProperties, Request $request = null)

0 commit comments

Comments
 (0)