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
-------
2377418443
[Security] Avoid unnecessary usage of Reflection
This commit is contained in:
commit
d5ba53547e
@ -78,9 +78,7 @@ class EncoderFactory implements EncoderFactoryInterface
|
|||||||
throw new \InvalidArgumentException(sprintf('"arguments" must be set in %s.', json_encode($config)));
|
throw new \InvalidArgumentException(sprintf('"arguments" must be set in %s.', json_encode($config)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$reflection = new \ReflectionClass($config['class']);
|
$encoder = new $config['class'](...$config['arguments']);
|
||||||
|
|
||||||
$encoder = $reflection->newInstanceArgs($config['arguments']);
|
|
||||||
|
|
||||||
if ($isExtra || !\in_array($config['class'], [NativePasswordEncoder::class, SodiumPasswordEncoder::class], true)) {
|
if ($isExtra || !\in_array($config['class'], [NativePasswordEncoder::class, SodiumPasswordEncoder::class], true)) {
|
||||||
return $encoder;
|
return $encoder;
|
||||||
|
Reference in New Issue
Block a user