8000 minor #34308 [Security] Avoid unnecessary usage of Reflection (chalasr) · symfony/symfony@d5ba535 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5ba535

Browse files
committed
minor #34308 [Security] Avoid unnecessary usage of Reflection (chalasr)
This PR was merged into the 4.4 branch. Discussion ---------- [Security] Avoid unnecessary usage of Reflection | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 2377418 [Security] Avoid unnecessary usage of Reflection
2 parents 36041a8 + 2377418 commit d5ba535

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ private function createEncoder(array $config, bool $isExtra = false): PasswordEn
7878
throw new \InvalidArgumentException(sprintf('"arguments" must be set in %s.', json_encode($config)));
7979
}
8080

81-
$reflection = new \ReflectionClass($config['class']);
82-
83-
$encoder = $reflection->newInstanceArgs($config['arguments']);
81+
$encoder = new $config['class'](...$config['arguments']);
8482

8583
if ($isExtra || !\in_array($config['class'], [NativePasswordEncoder::class, SodiumPasswordEncoder::class], true)) {
8684
return $encoder;