Skip to content

Commit 76e8bd6

Browse files
Merge branch '5.4' into 6.0
* 5.4: [Messenger] Fix dealing with unexpected payload in Redis transport [Filesystem] Update some PHPDoc of the Path class [VarDumper] Fix dumping mysqli_driver instances Fix missing ReturnTypeWillChange attributes [Cache] Add missing log when saving namespace [HttpKernel] Reset services between requests performed by KernelBrowser [HttpKernel] Remove unused argument in ArgumentMetadataFactory [Stopwatch] Fix test expectation [SecurityBundle] fix autoconfiguring Monolog's ProcessorInterface KernelTestCase resets internal state on tearDown [Security/Http] Fix getting password-upgrader when user-loader is a closure [HttpKernel] Fix extracting controller name from closures [Intl] fix wrong offset timezone PHP 8.1 Fix type binding Remove duplicated test [Dotenv] Fix reading config for symfony/runtime when running dump command [Serializer] Remove unnecessary break [Runtime] Fix dotenv_overload with commands Make document type nodes ignorable Initialize Symfony\Component\Security\Core\Exception\AccountStatusException:: property
2 parents a3b1935 + 53d572f commit 76e8bd6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

EventListener/PasswordMigratingListener.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ public function onLoginSuccess(LoginSuccessEvent $event): void
7171
$userLoader = $userBadge->getUserLoader();
7272
if (\is_array($userLoader) && $userLoader[0] instanceof PasswordUpgraderInterface) {
7373
$passwordUpgrader = $userLoader[0];
74-
} else {
74+
} elseif (!$userLoader instanceof \Closure
75+
|| !($passwordUpgrader = (new \ReflectionFunction($userLoader))->getClosureThis()) instanceof PasswordUpgraderInterface
76+
) {
7577
return;
7678
}
7779
}

Tests/EventListener/PasswordMigratingListenerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,16 @@ public function testUpgradeWithoutUpgrader()
8383
$userLoader = $this->getMockForAbstractClass(TestMigratingUserProvider::class);
8484
$userLoader->expects($this->any())->method('loadUserByIdentifier')->willReturn($this->user);
8585

86-
$userLoader->expects($this->once())
86+
$userLoader->expects($this->exactly(2))
8787
->method('upgradePassword')
8888
->with($this->user, 'new-hash')
8989
;
9090

9191
$event = $this->createEvent(new SelfValidatingPassport(new UserBadge('test', [$userLoader, 'loadUserByIdentifier']), [new PasswordUpgradeBadge('pa$$word')]));
9292
$this->listener->onLoginSuccess($event);
93+
94+
$event = $this->createEvent(new SelfValidatingPassport(new UserBadge('test', \Closure::fromCallable([$userLoader, 'loadUserByIdentifier'])), [new PasswordUpgradeBadge('pa$$word')]));
95+
$this->listener->onLoginSuccess($event);
9396
}
9497

9598
public function testUserWithoutPassword()

0 commit comments

Comments
 (0)